Object Hierarchies in Java 3D

Ok… Here’s the problem…

I’m VERY new to Java3D and I need to build a 3D model out of primitives but in a hierarchical structure… This because I need to animate it…

Can anyone help me find out how its done?

When people talk about object hierarchy I tend to assume they mean what object is a parent of another and I think you’re talking about scenegraph hierarchy which is a little different. Object heirarchy is relevant though because the things you’re going to want to be changing about your scene are all descended from Nodes which means they can have any number of other Node-based objects as children.

This means that you will probably want to create a main TransformGroup and add your central geometry primitives to it and then add child transformgroups with their own geometry and so on.

If you have three TransformGroups A, B and C where B is a child of A and C is a child of B then C can be moved alone, when B is moved C will also be moved to retain it’s relative position and when A is moved both B and C will be moved accordingly.

I’m sure I’ve seen a tutorial on this somewhere but I don’t recall where.

Thanx for the reply breakfast,

Ok the problem is that i’ve managed to setup the hierarchy of objects now in the same way you stated: using transformgroup’s to hold geometry at each level…

The problem now is that I have a single node with multiple children (‘centre’ node with body, arms and neck as children to it…) and some very undesirable behaviour occuring…

The arms seem to be fine at the moment, I created them as a hierachy of nodes with the geometry attached and the root node is attached to the shoulder which would then attach to the centre node…

The problem is with the body,
I attached the body to the centre node and I’ve tried everything to change to rotation to get it to stretch downwards instead of upwards (engulfing the head and neck) but its just not working…

Is there something wrong wid me setup or is it that i’m missing something?

Please help!!

Can you post part of your code to look what are you trying to do.

The hierarchy code

The transformation code that doesn’t work.

Rafael.-

Its ok thanx i managed to fix it!!

[quote]Its ok thanx i managed to fix it!!
[/quote]
I had the same problem. I fixed it by altering my hierecachy. Head must not be the super-parent. Make the super parent around the center of the guy (pelvis) What did you do ?

Well it was my transformation code that was dodgy so after I revised that it worked fine…

I also decided to do the same, I.e. I made a new node to represent the centre of gravity which sat at the top of the chest and that was were all the other objects extended from…