I'm using the path animator class to move the camera around a simple
square with curved corners.

Currently the camera follows the path perfectly, however, when it
reaches the end of the path, it slows right down, then jumps to the
start point.

Could someone let me know if I'm doing something wrong?

//This is my path:

var points : Array = new Array( );
points.push( new Number3D( - 11.2838 , ypos , - 13.0339 ) );
points.push( new Number3D( - 12.8106 , ypos , - 11.9801 ) );
points.push( new Number3D( - 15.0004 , ypos , - 9.30971 ) );
points.push( null , null , new Number3D( - 13.8975 , ypos ,
8.86661 ) );
points.push( null , null , new Number3D( - 12.5362 , ypos ,
11.9326 ) );
points.push( null , null , new Number3D( - 8.70525 , ypos ,
13.622 ) );
points.push( null , null , new Number3D( 10.4015 , ypos , 13.0808 ) );
points.push( null , null , new Number3D( 13.1333 , ypos , 11.281 ) );
points.push( null , null , new Number3D( 14.3658 , ypos , 8.76546 ) );
points.push( null , null , new Number3D( 14.9744 , ypos , -
8.32085 ) );
points.push( null , null , new Number3D( 12.98 , ypos , - 12.391 ) );
points.push( null , null , new Number3D( 6.6258 , ypos , -
14.1071 ) );
points.push( null , null , new Number3D( - 8.96165 , ypos , -
13.6072 ) );
points.push( null , null , new Number3D( - 10.0662 , ypos , -
13.4992 ) );
points.push( null , null , new Number3D( - 11.2838 , ypos , -
13.0339 ) );

var i : int = 0;
while (i < points.length)
{
        if (points[i] != null)
        {
                points[i].x = points[i].x * 98;
                points[i].z = points[i].z * 98;
        }
        i ++;
}
_path = new Path( points );
_path.smoothPath( );


// This is the code I use to update the position:

_time = _time + TIME_INC >= 1 ? 0 : _time + TIME_INC;
_pathAnimator.update( _time );


// init the animator like this:

var obj : Object = { duration:8000 , lookat:true , aligntopath:false ,
offset:new Number3D( 0 , 200 , 0 ) , fps:30 };
_pathAnimator = new PathAnimator( _path , _camera , obj );

Reply via email to