Hi,
I’m quite new to this wonderfull world of Java3d, and, of course, I’ve got lots of problems…
I’m trying to display a part of a huge background image depending on the direction the viewer is watching.
To do this, I get his rotational TransformGroup, and try to guess the angles between the direction it is watching and the right and up axis.
Alas, this doesn’t seem to work well.
I guess I’m not alone in this case, does anyone knows how to do it ?
For info, here is my source code. I apply the transform to the right and up axis and then retrieve the angle between them.
I don’t know what’s wrong here… I get incorrect values for angleUp and angleRight when I move too much my point of view.
Gérard
viewDirection.getTransform(trans);
double xPos=0;
double yPos=0;
test.x=Constants.right.x;
test.y=Constants.right.y;
test.z=Constants.right.z;
trans.transform(test);
test.y=0.0;
double angleRight = Constants.right.angle(test);
if (test.z<0.0)
angleRight=2*Math.PI-angleRight;
test.x=Constants.up.x;
test.y=Constants.up.y;
test.z=Constants.up.z;
trans.transform(test);
test.x=0.0;
double angleUp = Constants.up.angle(test);
if (test.z>0.0)
angleUp=2*Math.PI-angleUp;