Sign in to follow this  
anupgupta

movement with respect to angle

Recommended Posts

Assuming you mean in 2D, firstly construct a normal vector pointing in the direction:


vx=sin(angle);
vy=cos(angle);


Then multiply this by the amount you wish to move:


vx*=step;
vy*=step;


Then add these to the start position to move step units in the direction:


x+=vx;
y+=vy;

Share this post


Link to post
Share on other sites
Quote:
Original post by Aardvajk

vx=sin(angle);
vy=cos(angle);
Assuming the usual conventions of 0 radians/degrees corresponding to the positive x axis and positive rotations being counterclockwise, 'sin' and 'cos' should be swapped in the above.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this