Closed ghost closed 6 years ago
it would help if you shared the sample scene.
I've tested with a sample scene and it seems to be working fine for me.
Attaching my sample project.
BugTest.zip
Here is my project - CollisionTest.zip
Well, Kinematic bodies using move
are not supposed to be able to push a rigid since the method prevents overlaps (you need to create another body that collides with the rigids), I think the push is a bug here...
@eon-s That's what I thought, and I was checking for collisions and then applying an impulse. But someone pointed out that if you turn off can_sleep on the rigidbody you can push them with a KinematicBody. So there is a bug somewhere, but I don't quite know what the expected behavior.
No, the sleeping bodies can be pushed by kinematics moved by set position/translation.
A kinematic body child of the main body with 1% bigger size in shape can do that effect, but the move
one should never touch the rigid.
Godot physics, on the other hand, has the correct behavior, so is a Bullet problem.
Here is the same example in Godot Physics with a KB added as child, 2nd KB shape can be disabled to see how bullet should do it too (GP rigids seem to have more inertia so but the push effect is there).
Thanks a ton @eon-s - That makes sense. I played with your example and it seemed the second kinematic body only pushed the ball if the scale was set to 1.07 or higher from the front. The other angles seemed to be fine. Any ideas on that? That was in the Godot Physics engine.
There could be some precision issues in the separation process (which may be affecting bullet too, making it push the rigid).
CC @AndreaCatania
The problem is that the kinematic bodies doesn't push the rigid bodies so it's not possible by the kinematic body to wake up the rigid. I've already a solution, I'll make a PR soon.
@akien-mga also thanks you to let me know this issue.
Fixed #16757
The fix means it now won't stop on collide with rigids? (that is not the way Godot Physics 3D and 2D works)
True, but think about that. A kinematic body has always infinite inertia; it means that it can't never be stopped by a rigid body also is the opposite for the rigidbody that should always be pushed away by kinematic body.
In this moment the kinematic body has inertia 0 against rigidbody and can't never move a rigidbody.
Also in this moment both bullet and Godot physics has the same behaviour since neither godot is able to push a rigid body (due to the explanation above)
I understand that, Godot physics also created the need for complex body setups for interacting with rigid bodies, if this will be the new behavior I think it should be made for 2D too (there will be a revision for 3.1 if I'm not wrong, a good chance to break this).
The solution to add a kinematic as child of kinematic body basically move the child kinematic body in the position where the the parent is. Then the child will overlap a bit the RigidBody, so the rigidbody react to this overlaps with a movement.
As you see this is not a solution but a weird work around that for some reason works.
@AndreaCatania I'm not sure I understand the workaround. So if I have a KinematicBody and I want it to be able to push rigidbodies, then I need to to add a RigidBody set to MODE_KINEMATIC as the child of the KinematicBody?
@lane-s the workaround used a KinematicBody as child of the main body, so the transform of the child can overlap rigids to move them, but this is fixed now, not sure if is on 3.0, though.
I said that this work around is really bad, and I don't back it. however if you use the last version of engine you don't need any work around since I maked a change that allow all kinematics body to push the rigids
Using the latest release. If I have a kinematicbody run into a rigidbody head on, it doesn't push it. But approaching from an angle does. I have sleep turned off on the rigidbody.
Here is a video showing the issue: https://youtu.be/4XsyRHYRI94