Try make a new Path object, pass only the vectors.

Fabrice

On Jun 3, 2011, at 8:36, Moritz <[email protected]> wrote:

> Hello alltogether,
> 
> I've got a problem with the PathAnimator. My Path is composed of 30
> PathCommands, but the animated object only follows the first one and
> then teleports back to the starting point.
> 
> The path looks  fairly valid to me, I even visualized it using
> LineSegments and the lines added up to a nice, gapless trail.
> Unfortunatly I cannot really post the exact code I use for generating
> the path since it is quite complicated and depends on a lot of other
> factors, but here is what I get when I trace the path.array (with
> little " | "s between each PathCommand):
> 
> PathCommand: C, Vector3D(0, 0, 0), Vector3D(17.45348763652146,
> 31.202836117888964, 300), Vector3D(17.45348763652146,
> 31.202836117888964, 600) | PathCommand: C, Vector3D(17.45348763652146,
> 31.202836117888964, 600), Vector3D(75.45044119326013, 88.846957808724,
> 900), Vector3D(75.45044119326013, 88.846957808724, 1200) |
> PathCommand: C, Vector3D(75.45044119326013, 88.846957808724, 1200),
> Vector3D(134.2064586494376, 151.6906980439886, 1500),
> Vector3D(134.2064586494376, 151.6906980439886, 1800) | PathCommand: C,
> Vector3D(134.2064586494376, 151.6906980439886, 1800),
> Vector3D(336.9723958312828, 233.33278905486756, 2100),
> Vector3D(336.9723958312828, 233.33278905486756, 2400) … .
> 
> If the problem is not the path, then it must be somewhere in the
> following code:
> 
> public class Eagle extends Entity
>    {
>        [Embed(source = "/../grafikMaterial/Modelle/adler_animiert.md2",
> mimeType = "application/octet-stream")]
>        private var eagleModel:Class;
>        [Embed(source = "/../grafikMaterial/Modelle/adler_diffuse.jpg")]
>        private var eagleDiffuse:Class;
>        private var eagleMesh:Mesh;
>        private var animationData:AnimationData;
>        private var pathAnimator:PathAnimator;
>        private var time:Number = 0;
> 
>        public function Eagle()
>        {
>            super();
>            var eagleMaterial:BitmapMaterial = new
> BitmapMaterial(Cast.bitmap(eagleDiffuse));
>            eagleMesh = Md2.parse(Cast.bytearray(eagleModel));
>            eagleMesh.material = eagleMaterial;
>            eagleMesh.centerPivot();
>            eagleMesh.x = eagleMesh.y = eagleMesh.z = 0;
>            eagleMesh.scale(0.4);
>            eagleMesh.rotationY = 180;
>            this.addChild(eagleMesh);
>            this.animationData =
> eagleMesh.animationLibrary.getAnimation("fly");
>        }
> 
>        //[…]
> 
>        public function followPath(path:Array)  //Called by the Document
> Class after some Event
>        {
>            if (this.pathAnimator == null)
>            {
>                this.pathAnimator = new PathAnimator(path, this,
> { alignToPath:true } );
>                trace("eagle's Path = " + path.array[0] + " | " +path.array[1] 
> + "
> | " + path.array[2] + " | " +path.array[3]);
> 
>                this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
>            }
>        }
> 
>        private function enterFrameHandler(evt:Event)
>        {
>            this.time = (this.time + 0.005 > 1)? 0 : this.time + 0.005;
>            this.pathAnimator.update(this.time);
>        }
>    }
> 
> 
> Please help, I really feel stuck on this one :( .
> 

Reply via email to