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

Fix rigid body ray cast CCD in 2D and 3D Godot Physics #55773

Merged
merged 1 commit into from
Dec 11, 2021

Conversation

pouleyKetchoupp
Copy link
Contributor

For 2D:
Raycast CCD now works the same as in 3D, it changes the body's velocity to place it at the position of impact instead of generating a contact point that causes a wrong push back.

For both 2D and 3D:
The raycast CCD process reads and modifies body velocities, so it needs to be moved to pre_solve() (processed on the main thread linearly) instead of setup() (processed on multiple threads in parallel), otherwise multithreading can cause some CCD results to be randomly lost when multiple collisions occur involving the same body.

Fixes the raycast CCD part of #9071
In 2D, shapecast CCD is still not working correctly.

servers/physics_2d/godot_body_pair_2d.cpp Outdated Show resolved Hide resolved
For 2D:
Raycast CCD now works the same as in 3D, it changes the body's velocity
to place it at the impact position instead of generating a contact point
that causes a wrong push back.

For both 2D and 3D:
The raycast CCD process reads and modifies body velocities, so it needs
to be moved to pre_solve() instead of setup() to be processed linearly
on the main thread, otherwise multithreading can cause some CCD results
to be randomly lost when multiple collisions occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants