my object seemed to stuck in the air without falling down,
it's like floating in the air.
i wrote a code to resize my rigid body, it's a box shape,
however if i resize it to other size it would fall down, but some size just stucked in the air.
I checked the activation state it is true,
however when i trace the velocity,
it is like having an upward velocity instead of downward,
i have checked my gravity, it is supposed to be accelerate the object downward.
Here's the snippet code
Code: Select all
// activate object
lpRigidBody->activate();
// resize box shape
btBoxShape * lpBoxShape = (btBoxShape *) lpRigidBody->getCollisionShape();
btVector3 halfExtent(dstHalfWidth, dstHalfHeight, dstHalfDepth);
lpBoxShape->setSafeMargin(halfExtent);
btVector3 margin(lpBoxShape->getMargin(), lpBoxShape->getMargin(), lpBoxShape->getMargin());
lpBoxShape->setImplicitShapeDimensions(halfExtent * lpBoxShape->getLocalScaling() - margin);
// update inertia tensor
btVector3 localInertia (0, 0, 0); // object local center
lpBoxShape->calculateLocalInertia(1.0f, localInertia);
lpRigidBody->updateInertiaTensor();
could anyone help me with this?
thanks