I want to rotate arround the complete object´s X and Y Axis.

Software: Away3D 4.x

ANDI, Newbie
Posted: 16 July 2013 02:32 PM   Total Posts: 4

Hi I want to rotate the targetcamera around an objekt which is at 0,0,0.

here is some code i wrote:

var cameraRotatorX:Number = stage.width / 2 - mouseX;
    var 
cameraRotatorY:Number = stage.height / 2 -  mouseY;
    
cameraRotatorY += 0.0+cameraRotatorY/100 ;
    
cameraRotatorX += 0.0 + cameraRotatorX / 100 ;
      
camera.y =   Math.sin( cameraRotatorX  / 180 * Math.PI  ) * cameraDis;  
  
      
camera.x = Math.sin(cameraRotatorY / 180 * Math.PI) * cameraDis;
 
   
   
camera.z =    Math.cos( -cameraRotatorX / 180 * Math.PI) *   Math.cos(cameraRotatorY / 180 * Math.PI)   *     cameraDis; 
  
    
camera.lookAt(new Vector3D(  ) ); 

The Problem is with this code the rotation of the camera arround the Y-Axis of the object. The Rotation is only 180 Degrees an then rotation backwords again.
I want to rotate arround the complete objects X and Y Axis.

Is there anyone who has done something like this ?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X