I have been working on Bullet for a few days and I got stucked with something strange.
As far as know, kinematic controllers are meant to move user controlled collision objects, such as players, enemies or moving platforms. I'm working on a game where I need to move, rotate and do different things with an L-shaped platform, so I thought I could use this feature. So I did a compound shape with 2 boxes as children, so I could archieve my goal easily, and I proceeded as following:
Code: Select all
btCompoundShape *colSha;
//do stuff with colSha
btTransform t;
t.setFromOpenGLMatrix(...);
btPairCachingGhostObject* ghostObject = new btPairCachingGhostObject();
ghostObject->setWorldTransform(t);
ghostObject->setCollisionShape (colSha);
ghostObject->setCollisionFlags (btCollisionObject::CF_KINEMATIC_OBJECT);
btKinematicCharacterController* controller = new btKinematicCharacterController (ghostObject,colSha,0.f);
Code: Select all
btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight, int upAxis = 1);
Many thanks in advance,
nokto.