It is possible. There are three basic scenarios:
(1) Move the scene graph around inversely to your mouse movements.
This is the easiest and guarantees that you will always be in the
general
locale of your Scene Graph.
Just attach your mouse to the first of two TransformGroup instances, the
first of which is attached to your main Scene Graph BranchGroup. The
first
instance should implement a transform which switches the X, Y, and Z
axis
directions. so that they switch the sense of left/right, top/bottom,
near/far.
(2) Change the transform affecting your particular view platform.
This is what you are trying to do, but are making a couple of mistakes.
The
first mistake is that you are using SimpleUniverse, which PREBINDS the
view
platforms to the locale (line 142 of the source code for SimpleUniverse
which
is included with your distribution.) This disallows you from adding any
more
transformations ahead of the viewing platform.
The second thing you did wrong was to take a Transform3D instance which
you
created successfully on your main scene graph (and attached it to your
mouse)
and try to reassign that Transform3D instance to the one contained
within
your viewing platform. Unfortuntely, those mouse behaviors affect the
TransformGroup directly, not the Transform3D contained within it. Your
action
of copying it did nothing useful.
The best answer to your question is therefore to not use SimpleUniverse,
and
construct all components of your program yourself. Fortunately, to do
this,
all you have to do is copy the source code to SimpleUniverse and adapt
it
anyway you want. This is also how I took care of a couple of other
problems
I posted to this group (and got no answer.)
(3) Attach your mouse to a completely different branchgroup. This allows you
to
navigate through the entire universe. Even the background is not
stationary,
as they are attached to individual branchgroups, not to the universe
directly.
This is straightforward. Create a brand new branchgroup. Add a
TransformGroup,
and then add your mouse behaviors to that TransformGroup instance. THEN,
attach it to your locale.
I don't think this last way is the ideal way, however. Try it yourself.
If
you want the source code to my example, ask me.
Eric
-----Original Message-----
From: The Casteels [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 24, 1998 9:46 AM
To: [EMAIL PROTECTED]
Subject: [java3d] simple navigation is it possible?
simple navigation is it possible?
I can build a simple world, I can place simple objects in it, I can move
and rotate the objects...........
Why is it so dificult to do the same with the viewpoint?
Why is the viewpoint so complicated?
Can someone please provide a "simple" example of the "simplest way" to
work with the viewpoint?
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/