Mass based on scale

teamAlpha
Posts: 6
Joined: Fri Mar 13, 2009 5:59 pm

Mass based on scale

Post by teamAlpha »

Hi everyone , and thanks for making this great library.

I have just one question to ask , and i hope i can get some replies.

I would like to know how i can set the mass based on object scale .

I have tried to calculate the mass like this:

Code: Select all

 
                       btScalar mass = (0.1f + scale.X/2) + (0.1f + scale.Y/2) 
                       + (0.1f + scale.Z/2);

                       btVector3 halfExtents( (scale.X + 0.5f) * 0.5f , (scale.Y+ 0.5f) * 0.5f ,                      (scale.Z+ 0.5f) * 0.5f  );
			btCollisionShape *shape = new btBoxShape(halfExtents);
			btVector3 localIner;
			shape->calculateLocalInertia(mass, localIner);


But for some reason the objects don't collide with each other....

If anyone could help , it would be really awesome.

Thanks.
fido
Posts: 14
Joined: Sun Mar 22, 2009 5:57 pm

Re: Mass based on scale

Post by fido »

Are you setting the computed localInertia to btRigidBody? Unless you do that, it's
considered to be static.