Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Feb 23, 2012 1:44 pm 
Offline

Joined: Mon Feb 13, 2012 1:54 pm
Posts: 6
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:
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


Top
 Profile  
 
PostPosted: Tue Feb 28, 2012 11:01 am 
Offline

Joined: Mon Feb 13, 2012 1:54 pm
Posts: 6
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group