[SOLVED] when should I use state.add_force and not add_force ?

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

and what does state. stand for ?
(docs say “add_force” but only “state.add_force” work in my code)
Thanks

Is it in 2D or 3D?

Zylann | 2018-06-29 12:56

it is 3D actually, should it matter ?

Asoth | 2018-06-29 21:28

:bust_in_silhouette: Reply From: Zylann

3D matters, because in 3D RigidBody doesn’t have an add_force method. You should use PhysicsDirectBodyState within the _integrate_forces callback.

Thanks !
I just found this too
https://godotdevelopers.org/forum/discussion/19316/is-apply-torque-impulse-missing-in-godot-3-0-2

well it is a bit tricky to get it at first but I start to understand.

Asoth | 2018-06-29 21:44