Danny Kahn wrote:
>
> I was wondering if there is an easy way to get a vector that represents the
> direction of the current view. I've looked through the Transform3D
> methods, and I don't see any that will accomplish this. There's obviously
> methods for getting the translational component of the Transform, but this
> is not the direction the view is looking in.
Well, well. Isn't it funny how things go. Last week I sent an email off
to the bugs list suggesting some extra documentation to deal with this.
Then I get a couple of private emails from some folks who had the j3d
team pass on my email to, and now this....
If you have a reference to the ViewPlatform, then you can always ask it
for it's VworldTransform. Next, you have to assume that the viewpoint is
going to facing in "some" direction when first added. Typically this is
along the -Z axis. To find out the current direction you are pointing:
Transform3D eyeTransform = new Transform3D();
Vector3D eyeDirection = new Vector3d(0, 0, -1);
myViewPlatform.getLocalToVworld(eyeTransform);
eyeTransform.transform(eyeDirection);
And there you have it. eyeDirection now contains the information about
your current view direction.
--
Justin Couch http://www.vlc.com.au/~justin/
Freelance Java Consultant http://www.yumetech.com/
Author, Java 3D FAQ Maintainer http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant
-------------------------------------------------------------------
===========================================================================
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".