[SOLVED] add_force to 3D body

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

Hello, it took me time but I think I just realised that add_force does only work for 3D object , doesn’t it?

:bust_in_silhouette: Reply From: metin

I never tried it but I think to apply a force to a RigidBody you have to use _integrate_forces(). There you can use add_force().
References:

Thank you dude ,
the doc is pretty cryptic for newbes like me but If I understand well :

func _integrate_forces(state):

is called first the same way as

func _physics_process(delta):

the first is use to make “your own physic” to a regular delta time
and the second is use to add “regular physic” to the engine physic loop ?

I tried this script in my body

func _integrate_forces(state):
var forcex = Vector3(3.3,4.5,6.2)
state.add_force(forcex, Vector3(0,0,0))

and it seems to work

i wish I could find this thread before asking :
How to properly use add_force in RigidBody (3D) - Archive - Godot Forum

Asoth | 2018-06-28 11:00