1
Graphics / Re: Movement in direction of a heading
« on: March 08, 2016, 05:19:36 pm »
Sorry, I should have explained better in my first post!
I have a ship, with a position (2D vector), angle (int), velocity (2D vector).
The objects position is updated:
pos.x and pos.y is then used to set the objects sfml pos. (draw.setPosition(pos.x, pos.y)
I have a ship, with a position (2D vector), angle (int), velocity (2D vector).
The objects position is updated:
Quote
vel.x = sin((PI/180)*angle) * speed * time;
vel.y = cos((PI/180)*angle)* speed * time;
pos = pos + vel;
pos.x and pos.y is then used to set the objects sfml pos. (draw.setPosition(pos.x, pos.y)