What type of collision object for kinematics?

blarglenarf
Posts: 2
Joined: Thu Jul 04, 2013 7:21 am

What type of collision object for kinematics?

Post by blarglenarf »

I've been wondering what is The Right Way to model a kinematic object in bullet. I can get the desired behaviour using a btRigidBody with 0 mass and setting the appropriate collision flags, or I can use a btCollisionObject. Are there any drawbacks or advantages to either method? Which one is preferred? If I do use a btRigidBody, should I set its velocity or should I be manually updating its position by changing its world matrix?

Thanks in advance.
Neirdan
Posts: 13
Joined: Thu Jun 13, 2013 8:07 pm

Re: What type of collision object for kinematics?

Post by Neirdan »

A btRigidbody IS a btCollisionObject. http://bulletphysics.com/Bullet/BulletF ... bject.html
I am in the same situation and I tried different stuff, apparently you can not use velocity with a kinematic object.
Your kinematic object should be flagged as one and should have a mass of 0.
If you want to modify your object kinematically, you'll have to use body->getWorldTransform().setOrigin(btVector3 NewPosition);
I advise you to check the btKinematicCharacterController since moving a body by modifying it's world transform do NOT perform collision test by default, but it has been solved in the kinematic character controller. It tests if it's possible to go from start to end without colliding with anything and if the callback detects something then it only partially execute the translation.

Also, check the character demo.
blarglenarf
Posts: 2
Joined: Thu Jul 04, 2013 7:21 am

Re: What type of collision object for kinematics?

Post by blarglenarf »

I'm aware that a btRigidBody is a btCollisionObject, as I said I can modify either of them kinematically, I was just wondering if there is any unnecessary overhead for using a btRigidBody as opposed to just creating a new btCollisionObject (or a btGhostObject). I've experimented with the btKinematicCharacterController and the character demo, and I am aware of how it does it's collision detection. The question was more about which is the best way, since I can get the desired behaviour using any of these approaches.