Scooby Posted August 31, 2011 Share Posted August 31, 2011 Hi, I wonder if anyone can help me with this. I want to move a created vehicle forwards using setElementVelocity, The vehicle is stationary to start with. im not sure how to get the x and y needed for setElementVelocity, from the rotation of the vehicle to move it forwards. can anyone help me out with this equation? or am i missing an easier way to do this? Link to comment
SDK Posted August 31, 2011 Share Posted August 31, 2011 This is one way speed = 0.5 _,_, rotz = getElementRotation(vehicle) rotz = math.rad(rotz) vel_x = speed * math.sin(rotz) * -1 vel_y = speed * math.cos(rotz) setElementVelocity(vehicle, vel_x, vel_y, 0) Link to comment
Scooby Posted August 31, 2011 Author Share Posted August 31, 2011 nice one man, that looks like it has what i need, thanks alot 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