SFML community forums

Help => General => Topic started by: Dacapo on October 23, 2021, 09:01:24 am

Title: Is there any method to move a sprite/shape according to his rotation ?
Post by: Dacapo on October 23, 2021, 09:01:24 am
Does any method that move the sprite/shape according to his rotation. For example if it is rotated by 90 degrees, it will move forward by x:1 and y:0, if it is rotated by -90 it will move forward by x:-1 y:0 if it is rotated by 0 degrees it will move forward by y:1 x:0  etc...
Or do I have to do all the calculus by myself ? If I have to, what are the most efficient function to code ?
Title: Re: Is there any method to move a sprite/shape according to his rotation ?
Post by: G. on October 23, 2021, 05:00:20 pm
You'd have to compute it yourself. Using cosine and sine. (Or maybe a lookup table if you only have a few fixed angles)