Hi Dean,
this is a simple example that describes how to let rotate your viewpoint
around an object. The object has to be in the center of its coordinate
system. The viewpoint has to be in the same coordinate system as the object
in question. If not, you first have to apply some coordinate
transformations :-(
Navigation is done via mouse.
int x = mouseEvent.getX() - old_x;
int y = old_y - mouseEvent.getY();
Vector3d rotationAxis = new Vector3d(-y,x,0);
double angle = rotationAxis.length() ;
viewpointTransform3D.transform(rotationAxis);
AxisAngle4d ax = new AxisAngle4d(rotationAxis, angle);
Transform3D rotation = new Transform3D();
rotation.set(ax);
viewpointTransform3D.mul(rotation, viewpointTransform3D);
viewpointTransformGroup.setTransform(viewpointTransform3D);
old_x = mouseEvent.getX();
old_y = mouseEvent.getY();
Gernot
[EMAIL PROTECTED]
http://www.janet.de
Dean Keeler
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
> cc:
Sent by: Discussion Subject: [JAVA3D] Orbiting the
View around an object
list for Java 3D API
<JAVA3D-INTEREST@JAV
A.SUN.COM>
27.01.00 22:31
Please respond to
Discussion list for
Java 3D API
Hi,
I want to be able to orbit my view around the center of object in 3D space.
Currently I am rotating my view which causes my object to disappear from
view and so I have to pan over to where the object is. I want to be able
to orbit my view around an object so that the object never leaves my view.
I do not want to rotate the object, I want it to stay in its true position
when it was read in. Can anyone tell me how to do this and what math is
involved? Can I establish an anchor or pivot point for my view to rotate
around? Please help if you can, I'm trying to resolve this ASAP.
Thanks,
Dean
===========================================================================
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".