John Smith Posted December 21, 2014 Share Posted December 21, 2014 hello there i was messing around with projectile function(createProjectile) and it was fun yeah but i don't really know how to change projectile's path to be more clear this is what i want to do - i get in let's say s.w.a.t. vehicle because it has a turret - i click a key and it fires a rocket depending on turret rotation and position i know how to make a projectile, bind a key and that stuff but i don't know how to do the following 1) create that projectile exactly on (getVehicleTurretPosition) which doesn't have a z value? 2) set projectile's rotation exactly to follow the direction of turret(if pointed to air, it would go in that direction;air) 3) make that projectile really fast without it actually changing original direction i have ended up with just projectiles going all around who knows where, they seem also to be like flies(just go and circle around for no reason) if anyone can help me with those projectile directions,rotations i would appreciate it,thanks. Link to comment
Bonsai Posted December 21, 2014 Share Posted December 21, 2014 The turret has a certain offset to the vehicles position, thats how you can get the Z value. Horizontal rotation should be easy to use in https://wiki.multitheftauto.com/wiki/Ge ... ceRotation to get the point. Vertical rotation seems to be a bit more complicated. Link to comment
John Smith Posted January 24, 2015 Author Share Posted January 24, 2015 i still am not sure how to predict where a projectile will be shot at with regular weapons and creating projectiles onto them its easy because of the functions getPedTargetStart and getPedTargetEnd can this (creating projectiles from turret towards point that turret is facing) be done with getting camera matrix or something? i just want to increase the distance where rhino can shoot at edit: maybe with useful function getPositionFromElementOffset? -- function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z 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