Kinematic object questions

cody
Posts: 2
Joined: Sun Jan 22, 2012 12:52 pm

Kinematic object questions

Post by cody »

Hi,
I plan to use bullet for one of my projects. Although the documentation could be improved, I assume I understood most of bullets concepts, except kinematic objects.
The main thing that confuses me is, that kinematic objects are meant to be used as animated static objects, but here in the forum I keep reading about strange results when moving kinematic objects.

1st Question:
C) Kinematic objects, which are objects without mass, but the user can move them. There is on-way interaction, and Bullet calculates a velocity based on the timestep and previous and current world transform.
That is what the api docs say about kinematic objects. But i keep reading about kinematic objects behave as if they where teleported and not interpolated. Is this a problem when setting the transform via btCollisionObject::setWorldTransform or do they also occur when using motion states (which is the intended way of passing the new position, according to the manual)?

2nd Question:
Kinematic objects are rigid bodies. What happens if I set the kinematic object flag on a rigid body with non-zero mass, does it behave like a (normal) kinematic body with zero mass?

3rd Question:
If the previous works... is it possible to change the collision flags during runtime? Intended usage: I have a rigid body, let it be a box, and now the player may grab this box. Now the box should no longer be falling down nor be pushed away or likewise, but it has to be moved (animated) according to the user input and push away other rigid bodies.

Thanks,
Cody
MaxDZ8
Posts: 149
Joined: Fri Jun 24, 2011 8:53 am

Re: Kinematic object questions

Post by MaxDZ8 »

i keep reading about kinematic objects behave as if they where teleported and not interpolated. Is this a problem when setting the transform via btCollisionObject::setWorldTransform or do they also occur when using motion states (which is the intended way of passing the new position, according to the manual)?
I am one of those writing about 'warping' rather than interpolating, but I was really intending that in terms of velocity applied. I believe that kinematics should push much more.
Thinking again at it, I see most of my tests were with low-speed kinematics, which would make interpolation a very subtle effect (I only use MotionStates). Because of performance concerns, I can only afford 1 physics tick per frame.
In general, I'd say some of my previous statements might be the results of limited experimentation. If those are confusing you, I apologize.
What happens if I set the kinematic object flag on a rigid body with non-zero mass, does it behave like a (normal) kinematic body with zero mass?
Yes. The whole point is: Bullet won't move KINs, just as it won't move STATICs. I suppose a higher mass should result in more energy transfer in case of collisions against DYNs ("more push"). I'm still playing with mass ratios but I feel KINs should push more. Personal opinion.
If the previous works... is it possible to change the collision flags during runtime? Intended usage: I have a rigid body, let it be a box, and now the player may grab this box. Now the box should no longer be falling down nor be pushed away or likewise, but it has to be moved (animated) according to the user input and push away other rigid bodies.
I don't know if it is possible but it appears using a constraint is recommended.
MaxDZ8
Posts: 149
Joined: Fri Jun 24, 2011 8:53 am

Re: Kinematic object questions

Post by MaxDZ8 »

btBulletWorldImporter.cpp contains the following code

Code: Select all

				bool isDynamic = mass!=0.f;
				btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
createRigidBody seems to not do anything with the isDynamic boolean. Nonetheless, I am unsure whatever having positive-mass kinematics could be a good idea.
cody
Posts: 2
Joined: Sun Jan 22, 2012 12:52 pm

Re: Kinematic object questions

Post by cody »

Thanks for your reply.

From what you wrote and a bit more reading about kinematic bodies I now understand the problem. I assume we both are looking at it from a users perspective. But from the physics point of view it's easy to understand. KINs have no mass, that implies also zero impulse but bulles relies on impulse for calculating collisions as far as I know. When a rigid body hits a KIN, it (should be) deflected like when colliding with a static. But when a KIN hits a rigid body, the only the rigid bodies impulse can be taken into account. That means if it's impuls was zero before the collision, it will be zero after and it will only move as much as required to avoid intersections.

I don't know if bullet realy works that way, but it would explain the behavior you described. If positiv mass KINs are possible, they may be solve the issue as it would lead to non-zero impulse. If a moving object should push other objects away a rigid body with constraints is the intended solution I think.