# How to calculate velocity based on force at an angle

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.

• "But it's not" — what symptoms are you observing instead? Commented Mar 15 at 10:12
• Have updated my question with what is not working Commented Mar 15 at 10:24
• What heading do you call 0° here? +y or -y? Do you notice any deflection at all when changing the angle, even if it's not as sharp a turn as you expected? Commented Mar 15 at 11:09
• Hmm, there is a gradual change, we are talking minutes to see anything. 0deg should be north right? But my boat is going 90deg, east Commented Mar 15 at 11:20
• No, using the mathematical convention of x = cos(angle) as you're using, zero degrees points toward x+ (usually East in typical graphing layouts). If you want 0 to point up, swap cos and sin. You may have to negate one or the other depending on your coordinate, system, whether y+ points up or down, and whether you want angles to increase clockwise or counterclockwise. Commented Mar 15 at 11:24