Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GodotPhysics] Unexpected behavior while interacting with linear_velocity and state.linear_velocity. #79835

Closed
yosoyfreeman opened this issue Jul 23, 2023 · 7 comments · Fixed by #79977

Comments

@yosoyfreeman
Copy link
Contributor

yosoyfreeman commented Jul 23, 2023

Godot version

Godot 4 stable and Godot 3.x LTS

System information

Fedora linux

Issue description

If you use some custom logic inside _integrate_forces() to alter the state linear velocity and there is any reference to linear_velocity in physics process, the result in godot 3.5 is that it moves just a little bit, while in godot 4 is totally still.

Steps to reproduce

For the example i created a simple scene in which i apply a force on the linear velocity in _integrate_forces() and added a line that add zero to it in physics process. You will not see any move, but it will work fine if you comment the line adding zero.

Minimal reproduction project

PhysicsBugReproduction.zip

@Calinou
Copy link
Member

Calinou commented Jul 23, 2023

Can you reproduce this in 3.5 when using GodotPhysics instead of Bullet?

@yosoyfreeman
Copy link
Contributor Author

Yes. With Godot physics it behaves like in Godot 4. But the problem is still present.

@Calinou Calinou changed the title Unexpected behavior while interacting with linear_velocity and state.linear_velocity. [GodotPhysics] Unexpected behavior while interacting with linear_velocity and state.linear_velocity. Jul 23, 2023
@Zireael07
Copy link
Contributor

Just to clarify - you do NOT see the problem with Bullet physics in 3.x?

@yosoyfreeman
Copy link
Contributor Author

I'm sorry, let me clarify:

In godot 3.x the problem is exactly the same as in godot 4 with godot physics. With bullet, it almost equal, but seems like it still apply some kind of impulse. I think the difference is in implementation there, but the bug is present.

@Owl-A
Copy link
Contributor

Owl-A commented Jul 27, 2023

I would like to attempt to resolve this. I am a little inexperienced with godot but I'd like to try. Where should I start?

@Calinou
Copy link
Member

Calinou commented Jul 27, 2023

I would like to attempt to resolve this. I am a little inexperienced with godot but I'd like to try. Where should I start?

The 3D physics server code is at: https://github.com/godotengine/godot/blob/8367152723ebb96b1c799a9c6c9ac1d85178f80a/servers/physics_server_3d.cpp

That said, physics engines are notoriously a difficult area to learn due to a lack of modern game-focused resources. As a result, this may prove challenging to fix. We don't have a whole lot of contributors knowledgeable in the area.

@yosoyfreeman
Copy link
Contributor Author

yosoyfreeman commented Jul 27, 2023

I'm sorry if this is not useful information, but this error happens when using Godot Jolt too, which is weird cause they are different physics engines. Maybe this help to locate the problem? or this is a bug on a part of the code that Godot Jolt do NOT change / from which inherits, or this same error happens by pure chance on another whole different engine too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants