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

KinematicBody not pushing RigidBody at certain angles #16329

Closed
ghost opened this issue Feb 2, 2018 · 18 comments
Closed

KinematicBody not pushing RigidBody at certain angles #16329

ghost opened this issue Feb 2, 2018 · 18 comments

Comments

@ghost
Copy link

ghost commented Feb 2, 2018

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

@vkbsb
Copy link
Contributor

vkbsb commented Feb 2, 2018

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

@ghost
Copy link
Author

ghost commented Feb 2, 2018

Here is my project -
CollisionTest.zip

@eon-s
Copy link
Contributor

eon-s commented Feb 2, 2018

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...

@ghost
Copy link
Author

ghost commented Feb 3, 2018

@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.

@eon-s
Copy link
Contributor

eon-s commented Feb 4, 2018

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.

@eon-s
Copy link
Contributor

eon-s commented Feb 4, 2018

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).

CollisionTestGodotPhysicsKBChild.zip

@ghost
Copy link
Author

ghost commented Feb 4, 2018

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.

@eon-s
Copy link
Contributor

eon-s commented Feb 4, 2018

There could be some precision issues in the separation process (which may be affecting bullet too, making it push the rigid).

@akien-mga
Copy link
Member

CC @AndreaCatania

@AndreaCatania
Copy link
Contributor

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.

@AndreaCatania
Copy link
Contributor

Fixed #16757

@eon-s
Copy link
Contributor

eon-s commented Feb 16, 2018

The fix means it now won't stop on collide with rigids? (that is not the way Godot Physics 3D and 2D works)

@AndreaCatania
Copy link
Contributor

AndreaCatania commented Feb 16, 2018

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)

@eon-s
Copy link
Contributor

eon-s commented Feb 16, 2018

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).

@AndreaCatania
Copy link
Contributor

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.

@akien-mga akien-mga added this to the 3.1 milestone Feb 20, 2018
@lane-s
Copy link

lane-s commented Mar 30, 2018

@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?

@eon-s
Copy link
Contributor

eon-s commented Mar 30, 2018

@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.

@AndreaCatania
Copy link
Contributor

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

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

No branches or pull requests

5 participants