Thanks Preston, I will try this. When I move around using cursor keys, I have x,y,z values but no angles so I guess I can just pass 0. Is this right?
Yes. And in case you prefer to handle radian angles (0 .. PI) and not angles degrees (0..360) you can skip that Math.toRadians() method call, too.
Another thing is that where do I attach the camera to. Do I add it to the locale or do I add it to the root BranchGroup? (to get a kind of first person view)
tomcat
Yes, exactly. For my previously quoted example I've just made something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| private View mView = new View(); private BranchGroup mSceneBg = new BranchGroup(); void initXith(Canvas3D kanvas3d) { RenderPeer renderpeer = new RenderPeerImpl(); CanvasPeer canvaspeer = renderpeer.makeCanvas(freim, 320, 200, Opt.sGuiVollbildBpp, false); kanvas3d.set3DPeer(canvaspeer); mView.addCanvas3D(kanvas3d);
VirtualUniverse univers = new VirtualUniverse(); Locale lokal = new Locale(); univers.addLocale(lokal); univers.addView(mView); lokal.addBranchGraph(mSceneBg); } |