Move kinematic object without affecting bodies on top

Post Reply
ja0335
Posts: 1
Joined: Tue Sep 24, 2019 12:20 pm

Move kinematic object without affecting bodies on top

Post by ja0335 » Tue Sep 24, 2019 12:28 pm

Hi.

So I have a configuration of a box with mass=0 i.e a kinematic body acting as the ground and a rigid body box which start at some height.
The kinematic body is moving in the X, Z plane.

When I run the simulation the falling box hits the kinematic box and receives some torque due to the movement of the kinematic box.

What I want is use the kinematic box only as a collider but not to add any other forces to the colliding box. So if for example the rigid body is on top of it the kinematic box should only prevent it falling but not moving it.

I wonder if this behavior is possible.

kind regards :)

User avatar
drleviathan
Posts: 550
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Move kinematic object without affecting bodies on top

Post by drleviathan » Thu Sep 26, 2019 6:12 pm

When you move a kinematic object you don't need to give it non-zero velocities. If you do set its velocities non-zero it doesn't necessarily move forward in that way. Instead whenever the RigidBody needs to know its new transform external code must supply it (this is usually done via the MotionState API but can be done in a completely custom way). Nevertheless when its velocities at any moment are consistent with its motion over time then you get "more correct" collisions with dynamic objects.

In your case, you don't want "correct" collisions so you get to set its velocity to whatever works best for your purposes. You could just move the kinematic object around and set its velocities to be zero at all times, however that would still cause drag-on-contact when the dynamic object has a fast tangential linear velocity component to the kinematic objects surface. To minimize drag-on-contact you can set the friction coefficient of the kinematic object to zero.

Post Reply