This is my problem:
I have a model in .3ds ( a hand with many parts together, compound in Pop/Push Matrix of OpenGL) that I load in my program. I tried to create a appropriate collision shape using btTriangleIndexVertexArray an then a btGImpactMeshShape. It works but I had to fix the parts with joints that are not work very well for me....
I wonder how can I keep the system like the picture below after add physics?
I like to have the finger and the palm in the same position, like I was using the PopMatrix and the PushMatrix. There's a way to add the physics without change the position of the objects? And there's a way to keep the texture and graphics elements of this object?
How is the best collision shape to do it?
Please help me!
Thanks!
Better way to create a mesh?
-
- Posts: 21
- Joined: Wed Mar 25, 2015 2:04 pm
Better way to create a mesh?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 13
- Joined: Fri Oct 17, 2014 5:43 pm
Re: Better way to create a mesh?
Hi Carina. I am working on something very similar. I first converted the .3ds files to .obj. You can then use the ConvexDecomposition::WavefrontObj class to load the mesh. See the ConvexDecomposition demo for how to use it. I make a btConvexShape, then a btShapeHull and finally a btConvexHullShape, the latter being used to construct the rigid body for each hand part. (I might try to refine that to a btGImpactMeshShape later on, but for now I'm working with btConvexHullShapes.)
I display the shapes using GL_ShapeDrawer.drawOpenGL while I'm still debugging. Later, I will use the original mesh files as shown in your picture.
Right now, I am a bit stuck with the thumb. I use simple hinge constraints on the other 4 fingers and that works fine, using the setLimit method with both parameters the same (the angle read from the data glove).
But the thumb needs 2 dofs and I'm not sure what to use. I'm looking into btConeTwistConstraint, but I don't know how to set the orientation of the thumb as the setLimit method doesn't work in the same way. Can anybody give me a hint with this? Maybe getAFrame().setRotation() from the cone twist constraint? That would be my next try.
I display the shapes using GL_ShapeDrawer.drawOpenGL while I'm still debugging. Later, I will use the original mesh files as shown in your picture.
Right now, I am a bit stuck with the thumb. I use simple hinge constraints on the other 4 fingers and that works fine, using the setLimit method with both parameters the same (the angle read from the data glove).
But the thumb needs 2 dofs and I'm not sure what to use. I'm looking into btConeTwistConstraint, but I don't know how to set the orientation of the thumb as the setLimit method doesn't work in the same way. Can anybody give me a hint with this? Maybe getAFrame().setRotation() from the cone twist constraint? That would be my next try.
-
- Posts: 21
- Joined: Wed Mar 25, 2015 2:04 pm
Re: Better way to create a mesh?
Thanks segovia for the answer!
I am using the 6DOf constraint in the joints because no other works. I wanted use the hinge constraint but always happens a error in a assert... Do you had this error? You know why this happens?
thank you very much!
I am using the 6DOf constraint in the joints because no other works. I wanted use the hinge constraint but always happens a error in a assert... Do you had this error? You know why this happens?
thank you very much!
-
- Posts: 13
- Joined: Fri Oct 17, 2014 5:43 pm
Re: Better way to create a mesh?
I am able to use hinge constraints without errors. For example, between the first phalanx of the index finger and the palm:
Code: Select all
m_hinge[index1] =
new btHingeConstraint(*m_palmRB, *m_index1RB,
btVector3(3.2,0,10)*m_scale, btVector3(0,0,-0.5)*m_scale,
btVector3(1,0,0), btVector3(1,0,0));
dynamicsWorld->addConstraint(m_hinge[index1],true);