[SOLVED] Rigid Body stucked in the air after resize?

papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

[SOLVED] Rigid Body stucked in the air after resize?

Post by papaonn »

sorry i have a question regarding bullet rigid body,
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
Last edited by papaonn on Mon Dec 16, 2013 1:38 pm, edited 1 time in total.
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: Rigid Body stucked in the air after resize?

Post by papaonn »

I think i found the solution after digging into bullet source.

It seems like my manifold cache is not updated and need a reupdate on the Broadphase pair cache as well before the contact points could work normally.

I will have a check tonight.


(EDIT : Yes, everything worked fine now with the update to manifold and broadphase pair cached updated.)