Godot Version
Godot - 4.3
Question
I am trying to make a 2D spaceship with a single thruster which can be affected by physics. Here is the code I have used so far; just using a Rigidbody, CollisionShape2D, and a Sprite:
extends RigidBody2D
Called when the node enters the scene tree for the first time.
func _ready() → void:
pass # Replace with function body.
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta: float) → void:
if Input.is_action_pressed(“jump”):
apply_impulse(Vector2(0, -50), Vector2(0, -15))
The problem here is that I would like it to go up relative to the direction it is pointing, not relative to the ground, since right now it is constantly moving on the y axis, even if rotation is applied to it.
Thank you.