[Papervision3D] Camera Orbit in an ellipse?
Kevin Burke
pajhonka at yahoo.com
Thu Oct 14 08:51:11 PDT 2010
Okay, so I've narrowed my hunt down to modifying the code in the orbit
function so it moves in an elliptical path rather than a circle. I know
nothing about physics (but am happy to learn). I believe the yaw is what I'd
like to change...I tried multiplying it by .5 but the camera's circular
behavior did not change. I think the distance variable needs to relate to
the yaw? Can anyone confirm? Thank you!
http://papervision3d.758870.n4.nabble.com/file/n2995578/ellipse.jpg
public override function orbit(pitch:Number, yaw:Number,
useDegrees:Boolean=true, target:DisplayObject3D=null):void
{
target = target || _target;
target = target || DisplayObject3D.ZERO;
if(useDegrees)
{
pitch *= (Math.PI/180);
yaw *= (Math.PI/180);
}
// Number3D.sub
var dx :Number = target.world.n14 - this.x;
var dy :Number = target.world.n24 - this.y;
var dz :Number = target.world.n34 - this.z;
// Number3D.modulo
var distance :Number = Math.sqrt(dx*dx+dy*dy+dz*dz);
// Rotations
var rx :Number = Math.cos(yaw) * Math.sin(pitch);
var rz :Number = Math.sin(yaw) * Math.sin(pitch);
var ry :Number = Math.cos(pitch);
// Move to specified location
this.x = target.world.n14 + (rx * distance);
this.y = target.world.n24 + (ry * distance);
this.z = target.world.n34 + (rz * distance);
this.lookAt(target);
}
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Camera-Orbit-in-an-ellipse-tp2994683p2995578.html
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list