GImpact and UpdateBound()

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

GImpact and UpdateBound()

Post by tinibeenie »

Hi,

I'm new to Bullet and I have a problem with creating mesh shapes with GImpact. I want to create a btGImpactMeshShape, but if I call the function updateBound(), my application crashes. Here is the code:

Code: Select all

btTriangleIndexVertexArray* m_indexVertexArrays = new btTriangleIndexVertexArray
		(numTris,
		&triIndex[0][0],
		3*sizeof(int),
		numVerts,
		(btScalar*) vertValues,
		sizeof(btScalar)*3);

btGImpactMeshShape* trimesh = new btGImpactMeshShape(m_indexVertexArrays);
trimesh->setLocalScaling(btVector3(1.f,1.f,1.f));
trimesh->setMargin(0.07f);
trimesh->updateBound();
I saw a similar problem in this thread: http://www.bulletphysics.org/Bullet/php ... pdateBound. Is it necessary to integrate GImpact into the project? I thought, that Bullet contains GImpact. Or does it not? There occurs no linker error or any other errors.

I hope you can help me.

Regards,
Christin
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: GImpact and UpdateBound()

Post by Flix »

tinibeenie wrote:if I call the function updateBound(), my application crashes.

Code: Select all

btTriangleIndexVertexArray* g_indexVertexArrays = NULL; //Global
void initPhysics()
{
[...]
g_indexVertexArrays= new btTriangleIndexVertexArray
      (numTris,
      &triIndex[0][0],
      3*sizeof(int),
      numVerts,
      (btScalar*) vertValues,
      sizeof(btScalar)*3);

btGImpactMeshShape* trimesh = new btGImpactMeshShape(g_indexVertexArrays);
trimesh->setLocalScaling(btVector3(1.f,1.f,1.f));
trimesh->setMargin(0.07f);
trimesh->updateBound();
[...]
}
If this doesn't work it's because of the missing GImpact collision algorithm initialization or because of wrong mesh topology AFAIK.
tinibeenie
Posts: 6
Joined: Mon Feb 13, 2012 1:54 pm

Re: GImpact and UpdateBound()

Post by tinibeenie »

Thank you for the answer, Flix. It seems that I store the vertex data in the wrong way...