-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
KinematicBody still able to move Rigidbodies and VehicleBodies when infinite inertia disabled #31981
Comments
I think this is a duplicate of #25857, but this is a better description of the problem. |
Any workarounds for this issue? |
I have the same problem, but it manifests itself a bit differently. I have a FPS setup with a When the player collides with the I have noticed the same thing happening when I have a setup with 2 I have this problem on Godot |
I have the same problem (Godot 3.2.3, Windows). KinematicBodies cannot affect RigidBodies that are sleeping, however they can move RigidBodies already affected by physics. I am yet to find a proper workaround or alternative solution :( |
For info, this is a Bullet specific issue. I've tested the MRP on 3.2.3 stable: |
I have the same issue in Godot 3.2.3 Mono switching it from DEFAULT physics to Godot Physics in project settings as mentioned above fixes the issue for me. Edit: Increasing safe margin seems to fix a lot of the issues |
I've been investigating this, and the problem is that bullet backend doesn't correctly leave the collision margin between bodies when it moves a kinematic body. So when rigid bodies are processed, the kinematic body will be inside it's collision margin causing the rigid body to depenetrate and get pushed away from the kinematic body.
Edit2: there seems to be two parts to this problem:
This still seems to happen when using the Godot backend, it just is happening at a much slower rate. Godot seems to be using collision margins wrong too. Here's the project that I used to test this with which is a bit simpler than the one OP provided: infinite-inertia-bug.zip Using Godot physics notice that the cube is still pushed, and the sphere doesn't leave the collision margin between it and the cube. godot-no-collision-margin.mp4Using bullet backend bullet-correct-collision-margin.mp4 |
One potential workaround to this bug which works in both bullet and Godot physics, is to use collision exceptions/layers. One-way collision exceptions/layers aren't a thing at the moment, but you can get the same effect by doing something like this: remove_collision_exception_with(rigid_body)
move_and_slide(..., infinite_inertia=false)
add_collision_exception_with(rigid_body) then your kinematic body will never be able to move the rigid body unless you manual apply forces to it. This is slightly different than the just using |
@e344fde6bf Thanks for investigating! Concerning Godot Physics, I can confirm the issue does occur at a slow rate. From what I've seen, it's due to Apart from checking the gjk-epa algorithm itself, it might help to apply a little margin to the distance checks used for defining the safe and unsafe distances in |
Still present in godot 3.3-stable |
Still Present in Godot v3.3.3 stable |
Please forgive me if I get anything wrong here, I'm new here but I want to help. I built the master branch earlier and tested this problem using a CharacterBody3D which I think is the new name for KinematicBody. With CharacterBody3D, the move_and_slide function accepts no arguments, and there are no properties related to infinite_inertia anymore. Sliding the CharacterBody into a RigidBody in the way pictured below resulted in what I would say is the behaviour we expected from KinematicBody with infinite_inertia set to false. After making contact with the RigidBody cube, the sphere didn't move to the right any significant amount. I think any movement that did occur in the sphere and the cube were maybe just random jitter as I disabled can sleep on the cube. Hope this is helpful in some way. Please let me know if you need me to try any other scenarios. Project Zip: |
In 4.0, So now you have more options:
(this is the equivalent to @e344fde6bf's workaround described in #31981 (comment))
|
This comment was marked as off-topic.
This comment was marked as off-topic.
…n margin godotengine/godot#31981 (comment) (This is a whole rabbit hole. Read the ENTIRE thread + the number of duplicate issues, the state according to physics engine, status in 3.X/4.X and underlying parameters.)
Bugsquad edit: This issue has been confirmed several times already. No need to confirm it further.
Godot version: 3.1.1
OS/device including version: Ubuntu 19.04
Issue description:
According to the documentation, setting infinite inertia to false on a KinematicBody should make so it cannot move RigidBodies. However, when I disable it, I'm still able to move rigidbodies
Minimal reproduction project:
WASD movement
space to jump
mouse look
exit to escape
try pushing or jumping on the trucks, one uses VehicleBody and the other Rigidbody.
If you check the player script you can uncomment and use move_and_slide, move_and_slide_and_snap, and move_and_collide. All will move the trucks.
clustertruckclone.zip
The text was updated successfully, but these errors were encountered: