RigidBody3D : apply_force() headache.. please help me understand

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CallMeRED

Hello,

I’m new to Godot and I really like the nodes concept.
I’m trying to do a small car “sim” with a RigidBody3D(box) on 4 RayCast3D

that may sound silly but after days of headaches, I decide to seek for help
I’m very confused with how to use apply_force().

Could anyone help me understand ?

void apply_force ( Vector3 force, Vector3 position=Vector3(0, 0, 0) )

=> with position as the offset from the body origin in global coordinates.

  • position = body origin + local offset (all in global coordinates) ?

or

  • position = body origin (global coordinates) + local offset (local coordinates) ?

the only way i can make it “work” is by doing :

  • apply_force(- wheel_node.transform.basis.z * force , wheel_node.position)
    wheel_node.position => which is local offset from the car body ?!

but, when the car has rotated 180, every force applied is inverted ?!
(without applying any torque force)

Thank you.

:bust_in_silhouette: Reply From: CallMeRED

Forget it, I got it, it’s global ! … the joy of programming too much.