HoverController - finding the tiltAngle & panAngle from an object’s position

Software: Away3D 4.x

Karim Beyrouti, Administrator
Posted: 20 March 2012 02:47 PM   Total Posts: 30

I am trying to calculate the tiltAngle, and panAngle of an object for the HoverController, and am not
too sure where I am going wrong:

var obj3D  ObjectContainer3D getMarkerid );
var 
r:Number        =  Math.sqrt( ( obj3D.obj3D.) + ( obj3D.obj3D.) + ( obj3D.obj3D.) )
var 
theta:Number    = (Math.acos(obj3D.position.r))/(Math.PI/180);
var 
phi:Number      = (Math.atan2(obj3D.position.zobj3D.position.x))/(Math.PI/180);
   
cameraController.tiltAngle theta;
cameraController.panAngle phi

cameraController is a HoverController…

any help is appreciated


Thanks

 

Karim

   

Karim Beyrouti, Administrator
Posted: 20 March 2012 03:52 PM   Total Posts: 30   [ # 1 ]

Looks like this fixed it:

var r:Number =  Math.sqrt( ( obj3D.obj3D.) + ( obj3D.obj3D.) + ( obj3D.obj3D.) )
var 
theta:Number = (Math.acos(obj3D.position.r))/(Math.PI/180);
var 
phi:Number = (Math.atan2(obj3D.position.zobj3D.position.x))/(Math.PI/180);
       
cameraController.tiltAngle 90 theta;
cameraController.panAngle 90 phi 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X