-
mouse coordinates to sphere rotation
I project a sphere, the camera is in the center of the sphere, rotation of the camera is actually tilt nad pano: rotationX and rotationX
I need to convert mouse screen coordinates to the rotationX and rotationY of the sphere
here is what I have:
var movement:Number = 1000000/(getPerspective(500000)*1000000);
var xAxis:Vector3D = new Vector3D(movement*view.mouseX, 0, 500000);
xAxis.normalize();
var yAxis:Vector3D = new Vector3D(movement*view.mouseX, movement*view.mouseY, 500000);
yAxis.normalize();
var mousePan = Math.asin(Vector3D.X_AXIS.dotProduct(xAxis))*180/Math.PI + camera.rotationY;
var mouseTilt = Math.asin(Vector3D.Y_AXIS.dotProduct(yAxis))*180/Math.PI - camera.rotationX;
1000000 is the r of the sphere
getPerspective(500000) = camera.zoom*camera.zoom/500000
view is the container in which the sphere is projected
the above code works perfect as long as the camera is at tilt = 0 position
would any-one had an idea?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|