godot – Using add_force and add_torque to turn a RigidBody2D

Godot Scene tree

Scene (Node2D)
- RigidBody2D (Parent of Sprite and CollisionShape2D initially points to X direction/90 degrees)
-- Camera2D

When I apply_force() with “ui_up” key, the Vehicle moves correctly and remains in motion. However when I apply_torque_impulse() (such as ui_right) it turns but, then the Vehicle is moving/slipping sideways instead of towards the new direction. If I stop the motion by reversing the thrust, then start again it moves correctly in that new direction.

Seems I have to do some vector math math on the value of torque but I am not sure what.

extends RigidBody2D
var thrust = Vector2(0, 100)
var torque = 1024
var cot=Vector2(0,0)
var speed: int
var direction: int
func _ready():
func _integrate_forces(state: Physics2DDirectBodyState):
    if Input.is_action_just_pressed("ui_down"):
        speed -= 1
        add_force(cot, thrust.rotated(rotation))
    if Input.is_action_just_pressed("ui_up"):
        speed += 1
        add_force(cot, -thrust.rotated(rotation))
    if Input.is_action_just_pressed("ui_right"):
        direction += 1
    if Input.is_action_just_pressed("ui_left"):
        direction -= 1