HI,
I am having trouble with rotating around pivot points
I have loaded my model into the scene without problems
like so:
AseFile af = new AseFile();
BufferedReader br = null;
try {
// Attempts to read the file normally
br = new BufferedReader(new FileReader(path));
} catch (IOException e) {
// Attemts to read file from JAR
URL url = this.getClass().getClassLoader().getResource(path);
try {
br = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
AseReader r = new AseReader(br, af);
af.parse(r);
namedNodes = new HashMap ();
TransformGroup rootTG = af.getTransformGroupTree(namedNodes);
Transform3D transform = new Transform3D();
transform=rootTG.getTransform();
Transform3D myRot = new Transform3D();
myRot.rotY((float)Math.toRadians(180));
transform.mul(myRot);
rootTG.setTransform(transform);
Material mat2 = new Material();
mat2.setEmissiveColor(0f,0f,1f);
mat2.setSpecularColor(0.0f,0.0f,0.5f);
mat2.setAmbientColor(0.0f,0.0f,0.5f);
mat2.setDiffuseColor(0.0f,0.0f,0.0f);
mat2.setLightingEnable(true);
// Recursivly applies material to root BG
addMaterial(rootTG, mat2);
and I can access each part using :
TransformGroup backLeftLeg = (TransformGroup) namedNodes.get("Rear Left Leg");
Transform3D trans = backLeftLeg.getTransform();
But when I try to rotate using:
trans.rotZ(tate);
backLeftLeg.setTransform(trans);
the backLeftLeg rotates around a point somewhere below the foot (possibly 0,0,0)
The model is set at 0,0,0
and I have set my pivot points using 3Ds max 7 and saved the file using the helper options etc. as described in the tutorial
I also opened the ASE file to check that all the pivot points had been set - and they appear to be set at the right points
any ideas why this strange rotation is happening?
Cheers
Rmdire