Objects don't stop to move

Post Reply
tinibeenie
Posts: 6
Joined: Mon Feb 13, 2012 1:54 pm

Objects don't stop to move

Post by tinibeenie » Thu Feb 23, 2012 1:44 pm

Hi,

I have a simulation with some small concave meshes and a ground object. The ground is realized as a btBvhTriangleMeshShape, the other concave meshes are from type btGImpactMeshShape.

If I run the simulation, the objects fall down on the ground mesh and collide with it. But the most objects don't stop to move. They make very small movements and they don't collide with the other moving objects, only with the ground object. I tested some different properties, but haven't find the solution yet. Do you know, what's wrong here?

Here is my code:

Code: Select all

m_pCollisionConfiguration = new btDefaultCollisionConfiguration();
m_pDispatcher = new btCollisionDispatcher(m_pCollisionConfiguration);
m_pOverlappingPairCache = new btSimpleBroadphase();
m_pSolver = new btSequentialImpulseConstraintSolver;
m_pDynamicsWorld = new btDiscreteDynamicsWorld(m_pDispatcher,m_pOverlappingPairCache,m_pSolver,m_pCollisionConfiguration);
m_pDynamicsWorld->setGravity(btVector3(0,-10,0));

// then add the objects
m_indexVertexArrays = new btTriangleIndexVertexArray
		(numTris,
		triTab,
		3*sizeof(int),
		numVerts,
		(Real*) &vertices[0],
		sizeof(Real)*3);

btGImpactMeshShape* trimesh = new btGImpactMeshShape(m_indexVertexArrays);
trimesh->setLocalScaling(btVector3(1.f,1.f,1.f));
//trimesh->setMargin(0.07f);
trimesh->updateBound();
btCollisionShape* collisionShape = trimesh;
m_collisionShapes.push_back(collisionShape);
btRigidBody* body;
btScalar	mass(weight);
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
if (isDynamic) 
{
	collisionShape->calculateLocalInertia(mass,localInertia);
}
float masse = mass;
btDefaultMotionState* myMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(gravityCenter[0], gravityCenter[1], gravityCenter[2])));
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass, myMotionState, collisionShape, localInertia);
body = new btRigidBody(rbInfo);
m_pDynamicsWorld->addRigidBody(body);
I hope, you can help me.

Regards,
Christin

tinibeenie
Posts: 6
Joined: Mon Feb 13, 2012 1:54 pm

Re: Objects don't stop to move

Post by tinibeenie » Tue Feb 28, 2012 11:01 am

Have you ever heard of such a problem? I really have no idea what's wrong. Maybe, something is wrong with the inertia? Please give me a hint where I have to search for the error.

Post Reply