Skip to main content

Flying camera implementation

2 replies [Last post]
bkacirek
Offline
Joined: 2010-08-10

Some sample code I downloaded has methods to translate and move around my virtual terrain but the behavior is not quite what I want. I tried tweaking it but I'm new to j3d (and 3d programming altogether) I was wondering if anyone had a sample implementation of a "flying camera". Where the mouse controls the direction and forward and back will move along an imaginary axis that the mouse is pointing while the left-right keys will strafe the view. Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
darwinjob
Offline
Joined: 2004-11-16

Check for Java3D tutorials and samples - there is something like that if I remember correctly.

https://j3d-examples.dev.java.net/build-instr.html
Look for MoverBehavior

Also, maybe this is what you want? :
http://download.java.net/media/java3d/javadoc/1.5.2-latest/com/sun/j3d/u...

ralphld
Offline
Joined: 2010-08-02

I don't know if this fits your bill, but if you look here:

http://minitraff.cvs.sourceforge.net/viewvc/minitraff/Testing/DHUD3D.jav...
(hope that doesn't get broken)

and follow the "viewR" TransformGroup, I hope you can see what I'm doing.

I split translation and 'scale' away from rotation so that they dont impact each other as much.

I Rotate the 'scene' rather than the camera. You can see the finished program at:

http://minitraff.sourceforge.net/

Let me know if you have questions.
HTH
Ralph