Godot: _integrate_forces() is called even when `Custom integrator` is off in 3D RigidBody

Created on 30 Nov 2017  路  8Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
9678231b109c333a5273325c8758241310cd27f4, Ubuntu 17.04
Issue description:
_integrate_forces is called even when the Custom integrator check box is unchecked. I don't quite see any difference in behavior of the body when it's checked/unchecked. I'm not sure if this is desired behavior.
@AndreaCatania what do you think?

Steps to reproduce:

Link to minimal example project:

archived physics

Most helpful comment

In my experience this is the correct behavior. To quote the docs for _integrate_forces:

Allows you to read and safely modify the simulation state for the object. Use this instead of Node._physics_process if you need to directly change the body鈥檚 position or other physics properties. By default it works in addition to the usual physics behavior, but custom_integrator allows you to disable the default behavior and write custom force integration for a body.

It's always been my understanding that _integrate_forces is where you can directly access the physics state. custom_integrator is a separate feature that lets you override the default physics behavior if desired.

For example, in my asteroids-style game, if I want to teleport the ship to a new location, setting the position in _physics_process won't work, but using _integrate_forces and setting the Physics2DDirectBodyState.set_transform() works flawlessly.

All 8 comments

This happen with Godot physics too?

Yes with godot physics it's the case as well.

I'm quite sure that is a bug, but I need to check the code and its usage

In my experience this is the correct behavior. To quote the docs for _integrate_forces:

Allows you to read and safely modify the simulation state for the object. Use this instead of Node._physics_process if you need to directly change the body鈥檚 position or other physics properties. By default it works in addition to the usual physics behavior, but custom_integrator allows you to disable the default behavior and write custom force integration for a body.

It's always been my understanding that _integrate_forces is where you can directly access the physics state. custom_integrator is a separate feature that lets you override the default physics behavior if desired.

For example, in my asteroids-style game, if I want to teleport the ship to a new location, setting the position in _physics_process won't work, but using _integrate_forces and setting the Physics2DDirectBodyState.set_transform() works flawlessly.

I just tested custom_integrator and that seems to be working too. I think this issue can be closed.

custom_integrator is the parameter that should control the execution of _integrate_forces and in this moment it doesn't works

Hmm, that's not how it's ever worked before. custom_integrator disables the default force integration, but it doesn't disable _integrate_forces. Otherwise you wouldn't be able to use _integrate_forces to set position, etc. with the default physics behavior.

This is how it's worked at least since 2.1.2 when I started using Godot.

Yes you are right, I just looked the code and what you said is correct. So this is not an issue and can be closed

Was this page helpful?
0 / 5 - 0 ratings