Ok, so in my current project, I have several different subclasses of TG’s that represent different vehicles. At this point, they can move around in a bounded environment enclosed by a primitive skybox. Unfortunately in the rotate methods:
public void rotateHoriz(int right){
horizAngle += (float)(right*Math.PI/8);
Transform3D t = new Transform3D();
t.lookAt(location,
new Vector3f(location.x + (float)Math.sin(horizAngle), location.y + (float)Math.sin(horizAngle), location.z + (float)Math.cos(horizAngle) ),
new Vector3f(0, 1f, 0));
t.set(location);
setTransform(t);
}
public void rotateVert(int up){
vertAngle += (float)(up*Math.PI/8);
Transform3D t = new Transform3D();
t.lookAt(location,
new Vector3f(location.x + (float)Math.sin(horizAngle), location.y + (float)Math.sin(horizAngle), location.z + (float)Math.cos(horizAngle) ),
new Vector3f(0, 1f, 0));
t.set(location);
setTransform(t);
}
which look like that, the transformgroups fail to rotate in the right direction. I’ve tried rotY(horizAngle) and rotX(vertAngle), but the groups face the same direction anyway. Any suggestions?