Hello, newbie here.
I'm trying to make a RigidBody2D Node apply a force in the direction it's facing.
For example, if the object is facing upwards, I'd like it to apply a force to push it upwards, if it's pointing right, apply a force to push it right, and so on. All I can seem to do is apply a force to push it in one constant direction, nothing more.
I've tried the
apply_impulse function(s) with no luck to making this work; Just moves the RigidBody in a specific direction.
I've also tried using
cos() functions with
rotation_degrees with no luck.
Does anyone have any ideas/solutions?
For reference, I have a RigidBody2D with child nodes of a Sprite and CollisionShape2D. I made a small script to apply torque (and a failed attempt at force, hence why I'm here asking this question.)
if (Input.is_action_just_pressed("jump")) :
if (Input.is_action_pressed("left")) :
if (Input.is_action_pressed("right")) :
Thank you in advance! (Sorry if this is a stupid question; I'm new to this engine)