Here's the code from sample:
Code: Select all
btCollisionShape* chassisShape = new btBoxShape(btVector3(1.f,0.5f,2.f));
m_collisionShapes.push_back(chassisShape);
btCompoundShape* compound = new btCompoundShape();
m_collisionShapes.push_back(compound);
btTransform localTrans;
localTrans.setIdentity();
//localTrans effectively shifts the center of mass with respect to the chassis
localTrans.setOrigin(btVector3(0,1,0));
#endif
compound->addChildShape(localTrans,chassisShape);
tr.setOrigin(btVector3(0,0.f,0));
m_carChassis = localCreateRigidBody(800,tr,compound);//chassisShape);
Leaving 1 wouldn't be a problem, but returned coordinates for my mesh are aroung 0, -0.2, 0 which leaves my mesh half in the ground.
And the chassisShape box is over my car model.
If I remove compound variable and pass chassisShape to localCreateRigidBody instead, chassisShape perfectly aligns with my car model, but then again... car starts flying into the sky >,<
Can someone tell my how to stop car from flying or how to properly align my mesh with chassisShape?