How to use `_integrate_forces`?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Löwenhügel
:warning: Old Version Published before Godot 3 was released.

How does one use the _integrate_forces function of the rigidbody node? E.g. for manipulating the angular_velocity?
Examples are appreciated

:bust_in_silhouette: Reply From: kidscancode

The benefit of using _integrate_forces with your RigidBody node is that it passes you the Physics2DDirectBodyState, which contains a lot of information about the body’s state:

http://docs.godotengine.org/en/latest/classes/class_physics2ddirectbodystate.html#class-physics2ddirectbodystate

That means that you can directly affect angular velocity by using state.get_angular_velocity() and state.set_angular_velocity()

See here for an example of using _integrate_forces: https://youtu.be/J2MItemlTcE

Thank you, especially for the link I, unfortunately, hadn’t found before

Löwenhügel | 2017-09-03 17:03