[ODE] Simulating with trimesh

henrikmo@idi.ntnu.no henrikmo at idi.ntnu.no
Mon Aug 14 11:15:30 MST 2006


Hello again.
I managed to get the tool to fall towards the floor now by adding the code
below and extracting the position and rotation using the bodyid, which i
use to set the position and rotation of the OSG node/drawable.

dBodyID toolBody = dBodyCreate(world);
dGeomSetBody(triGeomId, toolBody);

My new problem is that the tool falls from a distance above ground and
straight trough the plane. I tried increasing the contact points from 12
to values up to 1000, but no change. Any idea? Is it the 10.7.6
requirement for manual update? I had almost convinced myself that it
regarded trimesh-trimesh collision. The floor is of course just a plane.
My other object (a simple box) acts as expected.

I have looked at the test_moving_trimesh, but when pressing the button to
drop in a new rabbit it falls through the floor, so I guess that demo
isn't a too good start since I need the mesh to drop to the floor and stay
there :)

-Henrik

henrikmo at idi.ntnu.no wrote:
> Thanks, but could anyone go into more detail? I am really a beginner with
> this, and the fundamental knowledge of ODE is missing. Maybe a few lines
> of code to illustrate? I am able to set up a basic scene with a box or
> sphere and drop it onto a plane and make it collide. But that is about it
> unfortunately. How do I simulate with the trimesh (i.e. get rotation and
> position). Basically, what is inside the sim loop? Here is some of my test
> code:
>
> triGeomID triGeomId = dCreateGeomTransform(0);
> dTriMeshDataID triDataId = dGeomTriMeshDataCreate();
> [...]
> dGeomTriMeshDataBuildSimple(
>   triDataId,
>   (dReal*)meshVertices,
>   visitor.accumData.vertices.size(),  //this is a osg drawableVisitor
>   meshIndices,
>   visitor.accumData.triangles.size()*3
> );
> dGeomTransformSetGeom(
>   triGeomId,
>   dCreateTriMesh(space, triDataId, 0, 0, 0)
> );
>
> What else do I need for the trimesh? The manual (10.7.6. Triangle Mesh
> Class) says I need to update the data manually. I didn't quite get this.
>
> -Henrik
>
>
> ZHANG Zikai wrote:
>> 2006/8/14, henrikmo at idi.ntnu.no <henrikmo at idi.ntnu.no>:
>>> Hello.
>>> I have no experience with ODE so please excuse the stupid questions.
>>>
>>> I have loaded a .osg file and made a dTriMeshDataID with a call to
>>> dGeomTriMeshDataBuildSimple with the corresponding inputs. I have
>>> called
>>> dGeomTransformSetGeom(geomid,dCreateTriMesh(space, triid, 0, 0, 0)),
>>> but
>>> i
>>> have no dBodyID for the.
>>>
>>> Is dBodyID required? If so, how do I do it for the trimesh?
>>> Is the dGeomID required for simulation since I am using OSG to draw?
>>
>> The dBodyID could be 0, and the mesh becomes a static environment.
>> see 7.2. dBodyID dJointGetBody (dJointID, int index); in the ode user
>> guide :)
>>
>>>
>>> The application is a glove controlled hand (several hinged boxes) which
>>> should be able to interact with the world by pushing away and possibly
>>> picking up different trimesh objects. Any tips? The hand should exist
>>> in
>>> the simulation, but have no gravity and if it touches an object, as
>>> little
>>> kinetic energy as possible should be transferred.
>>
>> I am not sure of this will help, try directly call dGeomSetPositon when
>> your
>> glove is moving. Since the static geom has no body, contact attach may
>> not work, but when the collision has been detected you can attach the
>> geom yourself. Something like 'glove.curHoldingGeom'.
>>
>>>
>>> There might be many followup questions :)
>>>
>>> Best regards
>>> Henrik Gundersen
>>>
>>> _______________________________________________
>>> ODE mailing list
>>> ODE at q12.org
>>> http://q12.org/mailman/listinfo/ode
>>>
>>
>> kaikai
>>
>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>




More information about the ODE mailing list