darhal Posted March 22, 2015 Share Posted March 22, 2015 Hi there, I want to ask if there is any way to manage the direction of the rocket created by createProjectile function ! because i made a script using this function the rocket dont go to the correct direction ! I use setCameraMatrix it s work but when i move its failed ! Link to comment
MIKI785 Posted March 22, 2015 Share Posted March 22, 2015 Just read the wiki, there are rotational arguments "rotX, rotY, rotZ: float starting rotation for the projectile.". IF you mean changing the direction after the rocket is fired i don't think that's possible. Link to comment
darhal Posted March 22, 2015 Author Share Posted March 22, 2015 I already read the wiki I m here firing at a specific x, y, z coordonation Link to comment
Enargy, Posted March 22, 2015 Share Posted March 22, 2015 What do you want to do with setCameraMatrix? Link to comment
darhal Posted March 22, 2015 Author Share Posted March 22, 2015 well I just use it to correct the direction of the rocket and it s work only when I m idle Link to comment
Mr.unpredictable. Posted March 23, 2015 Share Posted March 23, 2015 getElementPosition getElementMatrix getElementRotation this won't help setCameraMatrix Link to comment
darhal Posted March 23, 2015 Author Share Posted March 23, 2015 How this will help give me example please Link to comment
Mr.unpredictable. Posted March 23, 2015 Share Posted March 23, 2015 my formatting sucks but here's one example bindKey("vehicle_fire", "down", function() local assholeinvehcile = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(assholeinvehcile) local m = getElementMatrix(assholeinvehcile) local offX = 0 * m[1][1] + 1 * m[2][1] + 0 * m[3][1] + 1 * m[4][1] local offY = 0 * m[1][2] + 1 * m[2][2] + 0 * m[3][2] + 1 * m[4][2] local offZ = 0 * m[1][3] + 1 * m[2][3] + 0 * m[3][3] + 1 * m[4][3] vx = offX - x vy = offY - y vz = offZ - z local rotx, roty, rotz = getElementRotation(assholeinvehcile) createProjectile(getLocalPlayer(), 19, x+1, y-0.5, z+0.8, 5000, nil, 0, 0, 360 - rotz, vx, vy, vz) ------- not sure on which angle it is firing, just edit it. end) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now