I
believe you need to get the Transform3d first and then get the Vector3d from
that transform to get the current position.
From
looking at the 'getUserPosition()' function you don't have a 'getTransform()'
call...you need the getTransform first
so you
can get the Transform3d and then you get the Vector3f from the Transform3D using
.get(myVector) and then
that
should be the position of the object on which the Transform3D is being
applied.
Mario
Mariusz Zaczek
NASA - Johnson Space Center
Automated Vehicles and Orbit Analysis / DM35
Flight Design and Dynamics Division
Mission Operations Directorate
Bldg: 30A
Room: 3040A
Disclaimer: "The opinions, observations and
comments expressed in my email
are strictly my own and do not necessarily reflect those of NASA."
"Failure is never quite so frightening as regret." - Cliff's wife (The Dish)
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".-----Original Message-----
From: Luis Endo [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 2:07 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] How to get viewer position?Hi,I'm writing an application where the user can walk throw the scene using KeyNavigatorBehavior. I need to know the viewer position and the direction he is looking at.I've been trying to use bgrp.getLocalToVworld(tmatrix) (where bgrp is my BranchGroup object) to get the Transform3D (tmatrix) object. I wrote these two functions to get viewer's position and viewing direction without success:public Point3f getUserPosition() {
userPosition = new Point3f();
Vector3f transSave = new Vector3f();
tmatrix.get(transSave);
userPosition.add(transSave);
return userPosition;
}
public Vector3f getViewDirection() {// viewDirIni is the initial viewing direction...
Vector3f vDirAux = new Vector3f((float)viewDirIni.x,
(float)viewDirIni.y,
(float)viewDirIni.z);
Matrix3f rotM = new Matrix3f();
tmatrix.get(rotM);
rotM.transform(vDirAux);
return vDirAux;
}But when I print the values these functions return I always get the initial values set. Does anybody know what am I doing wrong?Another doubt is where can I find the javadoc for com.sun.j3d.utils.* classes.Thanks in advance.Luis Endo.
Conhe�a o novo Cad�? - Mais r�pido, mais f�cil e mais preciso.
Toda a web, 42 milh�es de p�ginas brasileiras e nova busca por imagens! =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
