Creating a free cam

Software: Away3D 4.x

Jobba, Newbie
Posted: 28 July 2011 11:12 AM   Total Posts: 1

Hi all,

I’m new to Away3D and trying to create a free cam (‘fly around’ through the scene). The basic movement is quite simple; updating pitch and yaw based on mouse position and forward movement based on if spacebar is pressed or not.
The difficulty I’m experiencing is in the forward movement: calculating the new values for the camera’s x, y and z properties, based on current rotation of the camera.
In my latest attempt I’m using the camera’s eulers to calculate direction. This works fine till I start circling around through the scene, resulting in movement in the wrong direction.

Here’s a bit of the code:

var eulers:Vector3D view.camera.eulers;
   
var 
dx:Number Math.sin(eulers.Math.PI/180) * Math.cos(eulers.Math.PI/180);
var 
dy:Number Math.sin(eulers.Math.PI/180);
var 
dz:Number Math.cos(eulers.Math.PI/180) * Math.cos(eulers.Math.PI/180); 

view.camera.+= _speed dx;
view.camera.+= _speed dy;
view.camera.+= _speed dz

Anyone who can point me in the right direction? Or perhaps with a working example?

Thanks!

   

John Brookes, Moderator
Posted: 28 July 2011 12:00 PM   Total Posts: 732   [ # 1 ]

camera.moveForward(speed)

   

Jobba, Newbie
Posted: 28 July 2011 12:16 PM   Total Posts: 1   [ # 2 ]

hahaha, hmm, it’s that simple! :D
Thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X