_integrate_forces stopps calls

: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.

Has anyone an idea, why no matter what I’m doing, the function _integrate_forces stops working as soon as the object (rigidbody) the script with the function in it is attached to isn’t moving anymore? _process and _fixed_process (as well in the same as in other scripts) continue their business

Can you check if that body is sleeping?

eons | 2017-09-17 21:34

It’s not when hitting play, and there is no code which could cause it to be. For testing purposes, I just put a timer in _integrate_forces and one in each of the process functions. The first stops as described, while the other both go on

Löwenhügel | 2017-09-19 19:30

If forces/velocities stop interacting with the body, it will be put to sleep, then you need to wake it up for it to accept changes on the state.

eons | 2017-09-20 02:21

Thank you for the information

Löwenhügel | 2017-09-20 06:34

There is a property for preventing sleep (can_sleep, I think), it will make the body to be processed on every physics frame even when the state is not active, that is not recommended if there will be many bodies on the scene (if is better to wake up the bodies or prevent sleep will depend on the game).

eons | 2017-09-20 21:57