gimpact and deformable meshes

Post Reply
topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

gimpact and deformable meshes

Post by topcomer »

I've started to use GIMPACT and I thought it would be good to edit the MovingConcaveDemo replacing the bunny with my mesh. I could create the mesh using initGImpactCollision() and move my mesh around with the mouse as a rigid body. So the next step was to move the vertices coordinates to deform the mesh. I did it in this way (where wheels is a list containing all the rigid bodies created):

void ConcaveDemo::updateExtMesh()
{
for( int i = 0; i < mesh_list.size(); i++ )
tf = pde->step();

for( int i = 0; i < mesh_list.size(); i++ )
{
MeshGeometry& geometry = mesh_list->geometry();
std::cout << geometry.x(0, 1) << std::endl;

for( VertexIterator v(*bmesh_list); !v.end(); ++v )
{
uint index = vertex_map(*v);

gVertices[3 * v->index() + 0] = geometry.x(index, 0);
gVertices[3 * v->index() + 1] = geometry.x(index, 1);
gVertices[3 * v->index() + 2] = geometry.x(index, 2);
}

btCollisionShape *wheel = NULL;

if( wheels.size() > i )
wheel = wheels->getCollisionShape();

if( wheel )
wheel = m_trimeshShape;
}
}

and called this function just after stepSimulation() and before renderme(). Hence the mesh should be deformed in an arbitrary way by my external solver and then just visualized as a change in the collision shape for the rigid body (kinematic or not). However this does not happen and the mesh displayed remains unchanged in the configuration I shoot it. That is, if I shoot it at the beginning it stays undeformed, if I shoot it after some time it is displayed as deformed but it doesn't change further. And if I shoot sveral bodies, they are all in the same configuration (the configuration at the time of the first shoot). I have no clue where the problem is, should I use something different rather than a rigid body?
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia
Contact:

Re: gimpact and deformable meshes

Post by projectileman »

With GImpact shapes you must call postUpdate() and then updateBound() after altering the mesh vertices.
Please take a look to the documentation:
http://gimpact.sourceforge.net/referenc ... guide.html

Thanks.

Att : Francisco
topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

Re: gimpact and deformable meshes

Post by topcomer »

projectileman wrote:With GImpact shapes you must call postUpdate() and then updateBound() after altering the mesh vertices.
Please take a look to the documentation:
http://gimpact.sourceforge.net/referenc ... guide.html

Thanks.

Att : Francisco
thanks for the reply.

I thought that postUpdate() and updateBound() were needed only to update the bounding boxes uses for the collision detection and not the coordinates of the vertices. I tried the very same code I posted over here inside bullet demo MoveConcaveMesh (which looks like GIMPACT demo) and I see that the mesh gets deformed. Isn't this demo using GIMPACT as well?
topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

Re: gimpact and deformable meshes

Post by topcomer »

I have a problem in the contact between a kinematic trimesh and the static ground present in MovingConcaveDemo. I managed to get the collisions using the following calls at each time step:

m_trimeshShape->postUpdate();
m_trimeshShape->updateBound();
body->setActivationState(DISABLE_DEACTIVATION);

however, I can't map the contact points onto the trimesh. Are the collision points different from the vertices of the mesh?
topcomer
Posts: 32
Joined: Thu Sep 21, 2006 1:53 pm
Location: sweden but italian

Re: gimpact and deformable meshes

Post by topcomer »

any hint? if I have to check all the collision points against all my triangles to find which are colliding it's pointless to use a fast collision detection..
Post Reply