The following used to work with V2.0 but no longer in V3.0:
apply_impulse(Vector2(), Vector2(0, -ACCELERATION).rotated(rotation))
It does the acceleration OK but the rotation seems to be locked straight up. I can no longer rotate and point where I want to go.
Here's the full code:
extends RigidBody2D
const ROTATE_SPEED = 250
const ACCELERATION = 5
func _physics_process(delta):
if Input.is_action_pressed("ui_left"):
rotate(-deg2rad(delta * ROTATE_SPEED))
if Input.is_action_pressed("ui_right"):
rotate(deg2rad(delta * ROTATE_SPEED))
if Input.is_action_pressed("ui_up"):
apply_impulse(Vector2(), Vector2(0, -ACCELERATION).rotated(rotation))
If I don't press UP, the LEFT and RIGHT will rotate the ship as expected. However, press UP and it locks going straight up, jiggling slightly if I press LEFT or RIGHT.
How do I make this work in V3.0?