Rotation problem

Hi,
I have exported simple figure in .3ds format (one body part per file) and then loaded them into Java3D. No problem with that - problem starts when I am trying to apply animation on individual parts. There has to be something I am not getting right - since I am not getting motion as I would expected.
First I have created test app and instead of using Poser body parts I have created parts mostly using geometry primitives like cylinders and spheres - then assembled them into “human” looking shape and then started putting animations into it and everything works fine. So I decided to use more realistically looking parts from Poser (.3ds) and that is where the problems started.
When I attach say right shoulder transform group into chest transform group and would like to apply rotation to shoulder - final rotation is not done with respect to chest TG but it looks like shoulder is not aware of the fact being attached to chest TG as its children - the result is obviously not what I have in mind.

I am going to put some source code here to illustrate this.

I load files : private TransformGroup loadBodyPart(String name) {
if (! (name == null)) {
Inspector3DS loader = new Inspector3DS(“models/” + name + “.3DS”);
loader.setLogging(true);
loader.setTextureLightingOn();
loader.parseIt();
TransformGroup theModel = loader.getModel();
Transform3D transformRotate = new Transform3D();
transformRotate .rotX(Math.PI / 3);

 theModel.setTransform(transformRotate );

 return theModel;

}
else {
Debug.print(" Loading [ " + name + " ] has failed ");
return null;
}
}

then I build model:

public void loadAvatar(Group rootBG) {

avatarTG = new TransformGroup();
avatarTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
avatarTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

headTG = loadBodyPart(“head”);
headTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
headTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
avatarTG.addChild(headTG);

neckTG = loadBodyPart(“neck”);
Transform3D neckT3D = new Transform3D();
neckTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
neckTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
headTG.addChild(neckTG);

chestTG = loadBodyPart(“chest”);
chestTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
chestTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
neckTG.addChild(chestTG);

rightshoulderTG = loadBodyPart(“rightshoulder”);
rightshoulderTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rightshoulderTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
chestTG.addChild(rightshoulderTG);

rightforearmTG = loadBodyPart(“rightforearm”);
rightforearmTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rightforearmTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rightshoulderTG.addChild(rightforearmTG);

righthandTG = loadBodyPart(“righthand”);
righthandTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
righthandTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rightforearmTG.addChild(righthandTG);

leftshoulderTG = loadBodyPart(“leftshoulder”);
leftshoulderTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
leftshoulderTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
chestTG.addChild(leftshoulderTG);

leftforearmTG = loadBodyPart(“leftforearm”);
leftforearmTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
leftforearmTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
leftshoulderTG.addChild(leftforearmTG);

lefthandTG = loadBodyPart(“lefthand”);
lefthandTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
lefthandTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
leftforearmTG.addChild(lefthandTG);

abdomenTG = loadBodyPart(“abdomen”);
abdomenTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
abdomenTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
chestTG.addChild(abdomenTG);

hipTG = loadBodyPart(“hip”);
hipTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
hipTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
abdomenTG.addChild(hipTG);

leftthighTG = loadBodyPart(“leftthigh”);
leftthighTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
leftthighTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
hipTG.addChild(leftthighTG);

leftshinTG = loadBodyPart(“leftshin”);
leftshinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
leftshinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
leftthighTG.addChild(leftshinTG);

leftfootTG = loadBodyPart(“leftfoot”);
leftfootTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
leftfootTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
leftshinTG.addChild(leftfootTG);

rightthighTG = loadBodyPart(“rightthigh”);
rightthighTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rightthighTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
hipTG.addChild(rightthighTG);

rightshinTG = loadBodyPart(“rightshin”);
rightshinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rightshinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rightthighTG.addChild(rightshinTG);

rightfootTG = loadBodyPart(“rightfoot”);
rightfootTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rightfootTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rightshinTG.addChild(rightfootTG);

// just for testing
MouseRotate r = new MouseRotate(avatarTG);
r.setSchedulingBounds(new BoundingSphere(new Point3d(), 1000.0));
rootBG.addChild®;

MouseTranslate d = new MouseTranslate(rightshoulderTG);
d.setSchedulingBounds(new BoundingSphere(new Point3d(), 1000.0));
rootBG.addChild(d);

MouseZoom z = new MouseZoom(avatarTG);
z.setSchedulingBounds(new BoundingSphere(new Point3d(), 1000.0));
rootBG.addChild(z);

Transform3D transformUP = new Transform3D();
transformUP.rotX(Math.PI / 2);

rootBG.addChild(avatarTG);
}

and then I apply rotation to right shoulder:

AxisAngle4f rightShoulderAxisAngle = new AxisAngle4f(-1.0f,0.0f, 0.0f, 1.0f);

public void setRightShoulderRot(int rotation) {
Transform3D tmpTrans = new Transform3D();
rShoulderRot = rotation;
rightShoulderAxisAngle.angle = (float) Math.toRadians(rShoulderRot);
avatar.rightshoulderTG.getTransform(tmpTrans);
tmpTrans.setRotation(rShoulderAA);
avatar.rightshoulderTG.setTransform(tmpTrans);
}

but as I have already said the resulting rotation is along the x-axis (as is in this case stated in AxisAngle4f) but I would expect to right shoulder to rotate with respect to chest transform group - but that is not what is happening …

Am I missing something basic.

Any insight into this would be greatly appreciated

just to inform humanity I found what was wrong ::slight_smile:
Basically I didnt know - and still dont know - how is Poser building its models. What I was doing first was I have exported all body parts from Poser into 3ds format and loaded them into my scene - all those TranformGroups had already specified its translations so to setup body was quick and easy but I simply dont know how that program is doing it internally so when I was trying to apply rotation on parts of the body everything was outta sync. So I have exported those part again and opened them in Max - one piece at he time and checked option “forget where you belong” - so each part opened at 0,0,0 - saved them all and loaded them again and this time I had to specify traslations where right shoulder and other parts should go. And now everything works…Hm… i admit it doesnt make sense (at least not to me) since I have done nothing what wasnt already done during exporting before…As I’ve said magic …but now all my animations works…if anybody has ever run into something similar and could gimme explanation why you have to this I’d be gratefull