[odejava] Transformgroups vs Odejava

I have small program in Java3d that simulates the human body, with each bodypart/joint represented as transformgroups in a child/parent manner.

I would like to use odejava on this to simulate physics when bodyparts coolide. Problem is, Ode uses global coordinates (to my knowledge) and each joint im my program has it’s own local coordinate system.
So there is a conversion problem at least, if not alot more.
Is there anyway that ODE can handle this ?
I would like to use odejava without breaking the existing structure too much.

I ran into the same problem. My solution was to “flatten” the scenegraph. This way, each TransformGroup representing a joint was attached directly to the root of the scenegraph. The other option (which I haven’t tried) is to keep the scenegraph intact and transform the rotations and orientations coming in from Ode into the TransformGroup’s local coordinate system by multiplying them by the inverse of the TransformGroup’s localToVWorld matrix. Hope this helps :slight_smile:

[quote]I ran into the same problem. My solution was to “flatten” the scenegraph. This way, each TransformGroup representing a joint was attached directly to the root of the scenegraph. The other option (which I haven’t tried) is to keep the scenegraph intact and transform the rotations and orientations coming in from Ode into the TransformGroup’s local coordinate system by multiplying them by the inverse of the TransformGroup’s localToVWorld matrix. Hope this helps :slight_smile:
[/quote]
Yes thanks :slight_smile: still think it’s too complitated though. Isnt there a way so these calculations are done automatically ?. I dont know if I’m right, but if you apply force to the shoulder transformgroup(rotation for example), you will automatically move all it’s children since they are in this transformgroup, thereby applying artificial, non ODE controlled movement to it’s children… At least ODE wouldnt be aware of this since it doesnt know anything about transformgroups. Maybe the final simulation would not look right this way ?

I assume you currently have something like this: http://xith.org/tutes/GettingStarted/html/transformgroup_trees_with_t.html
That is a tree of transform groups.

When you use ODE, you basically turn control of this over to ODE. Build your structure in ODE with bodies, joints, geoms and geomtransforms. If you turn a joint, all geometry (and therefore any 3D representations) attached to the body which is turning will move like you expect. In other words - use ODE to define the relationships of your geometry (e.g. arms and legs), then simply attach (bind) the 3D “skin” to this.

To achieve this, I personally use XODE to discribe the ODE bodies and geometry in a heirarchial manner, and the ASE 3D geometry format to describe the 3D shapes. In 3D Max, I have my objects grouped in “Transform groups” like what you are talking about. This allows me, using the ASE loader to import the geometry relitive to the various pivot points specified in 3D Max. I then bind the 3D geometry to the ODE objects created when parsing the XODE file and let Odejava handle the simulation.

Will.

Thanks for the advice. So you really do have to flatten your scenegraph and build your hierachy using ODE.
That really cleared up some things, thanks everybody :wink: