physics – How can I add directional friction like asteroids with SPEED and DIRECTION?


I’m trying to make asteroids, and right now I’m setting the direction based on the mouse angle, like so:

let r = Math.atan2(ct.mouse.x-this.x, ct.mouse.y-this.y) * 180 / Math.PI;

this.rotation = Math.round(r - 180);    
this.direction = Math.round(r - 90);

which works more like a car, as soon as you turn, you are moving in the new direction at the same speed.

but in asteroids it’s more slippery, and the direction doesn’t change immediately when you’re thrusting, it’s like it has to fight against the current direction and speed.

How can i change the direction and speed variables over time to reflect this? I don’t have true physics available.

I’m in ct.js by the way, but this is a mostly general question.