Sorry for not telling specific enough, here is my code:
/**
* BranchGraph for View BranchGroup
*/
private BranchGroup createView(Canvas3D c){
BranchGroup bg = new BranchGroup();
View view = new View();
view.setSceneAntialiasingEnable(false);
ViewPlatform vp = new ViewPlatform();
vp.setViewAttachPolicy(View.NOMINAL_SCREEN);
PhysicalBody body = new PhysicalBody();
PhysicalEnvironment pe = new PhysicalEnvironment();
view.addCanvas3D(c);
view.attachViewPlatform(vp);
view.setPhysicalBody(body);
view.setPhysicalEnvironment(pe);
TransformGroup tg = new TransformGroup();
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
bg.addChild(tg);
tg.addChild(vp);
KeyNavigatorBehavior key = new KeyNavigatorBehavior(tg);
key.setSchedulingBounds(new BoundingSphere());
bg.addChild(key);
return bg;
}
In this method, it creates the scene graph of the View, ViewPlatform,
PhysicalBody, PhysicalEnvironment. I setup a TransformGroup just above the
ViewPlatform below the BranchGroup. Then I attach the TransformGroup to the
KeyNavigatorBehavior like shown above, and set the SchedulingBounds and
addChild to the BranchGroup. This is what I learned from tutorial but it
doesn't work. Then I tried exactly the same thing from tutorial, using
SimpleUniverse, TransformGroup tg =
simpleuniverse.getViewingPlatform().getViewPlatformTransform(); returns the
TransformGroup between the BranchGroup and ViewPlatform. And I don't have
to modify any methods of keyPressed(KeyEvent e).
I also tried extending the KeyNavigatorBehavior class, and implement the
keyPressed() method, add it to the TransfromGroup of the ViewPlatform, but
it still doesn't work.
Hopefully I give enough information, since I really want to use keys(or I
can config some other keys, not necessary using the specified in
KeyNavigatorBehavior class) to navigator in VirtualUniverse. I am not using
SimpleUniverse since I wanna learn more about the ViewPlatform and stuff.
Thank you very much and waiting for your reply.
Sincerely,
Andy
----- Original Message -----
From: "Georg Rehfeld" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 8:03 AM
Subject: Re: [JAVA3D] Camera
> Dear Andy,
>
> > Hi, I may bother you all too much, but I really want to know that how do
I
> > move the view in the virtual universe, like flying around, which is done
by
> > keynavigatorbehavior. Cuz I am trying to construct a house, and I can
> > navigate inside. Thanks.
>
> I'm unsure from your question what you really are after. If you
> want to move around as with KeyNavigatorBehavior then just use it.
> If you don't know how to do that, you _definitely_ should read the
> Java3D tutorial, especially chapter 4.4 Behavior Utility Classes
> for Keyboard Navigation.
>
> If you want to do the keyboard/mouse handling on your own, you
> should look into the code for KeyNavigator and KeyNavigatorBehavior
> how they do it ... it boils down to manipulating the Viewplatform
> Transform. The Viewplatform is the place where your avatar/
> camera/eye sits (compare figure 4-8 from the tutorial) in the
> virtual world and that platform can be moved, turned and scaled
> freely by changing it's Transform taking the camera with it,
> resulting in a changed projection onto the canvas.
>
> If this both isn't what you wanted to know feel free to ask your
> question a little bit more specific.
>
> regards
>
> Georg
> ___ ___
> | + | |__ Georg Rehfeld Woltmanstr. 12 20097 Hamburg
> |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10
>
>
===========================================================================
> 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".
===========================================================================
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".