I have a 2D top-down jetboat that is moving (has a x
, y
velocity). I apply the velocity by multiplying against the delta time dt
:
position.x += velocity.x * dt
position.y += velocity.y * dt
Before that however I calculate the velocity with:
velocity.x += acceleration * cos(angle) * dt
velocity.y += acceleration * sin(angle) * dt
angle = (heading_current * M_PI) / 180;
Angle is in radians, and it should be changing the velocity x
, y
based on the angle at which the force is being applied.
Two things seem to be going on, one is that the angle
is at 0° and the boat travels toward 90°, and two, when I change the angle to anything else, the boat just continues on it 90° path. What am I doing wrong?
I hope that makes sense.