Math Problem: Direction and Distance

closed account (2NywAqkS)
I am making a Particle simulator thing and I couldn't work out the formula for finding the new position of a particle using only the direction and distance. If anyone knows any answers would be appreciated.
1
2
3
4
5
6
7
// assuming:
//  'x' and 'y' are the current position
//  'angle' is an angle specifying which direction the particle is moving
//  'speed' is the speed at which the particle is moving

x += cos( angle ) * speed;
y += sin( angle ) * speed;
closed account (2NywAqkS)
This was very helpful thanks
Topic archived. No new replies allowed.