I'm mobile atm, but try a simple one first like this 2 segments from minus 1000 
to positive 1000.

[-1000, 0,0, 
-500,0,0
0,0,0,
0,0,0
500,0,0
1000]

Remember that each PathCommand represent a curve quadratic with a start, anchor 
and end vectors.
The next one needs to have as start the same value as previous one end value.


Fabrice

On Jun 3, 2011, at 22:43, Moritz <[email protected]> wrote:

> Doesn't work either. I also tested using a cube-primitive instead of
> my model, but it still jumps back to start after having reached the
> third Vector3D ("pEnd").
> 
> New code:
> 
> […]
> public function followPath(pathVectors:Array)  //Called by the
> Document Class after some Event
> {
>    if (this.pathAnimator == null)
>    {
>        Var path:Path = new Path(pathVectors);
>        this.pathAnimator = new PathAnimator(path, this,
> { alignToPath:true } );
>        trace("eagle's Path = " + pathVectors[0] + pathVectors[1]  +
> path.array[2]  + " | " + path.array[3]  + pathVectors[4] +
> pathVectors[5] + " | " + pathVectors[6]);
> 
>        this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
>    }
> }
> […]
> 
> New trace:
> Eagle's Path  = Vector3D(0, 0, 0),Vector3D(26.135709113441408,
> 56.92195810116378, 300) ,Vector3D(26.135709113441408,
> 56.92195810116378, 600) | Vector3D(26.135709113441408,
> 56.92195810116378, 600),Vector3D(29.517402342494407,
> 137.12164446189104, 900) ,Vector3D(29.517402342494407,
> 137.12164446189104, 1200) | Vector3D(29.517402342494407,
> 137.12164446189104, 1200), ...
> 
> I kind of solved the problem by simply giving the PathAnimator only
> one PathCommand at a time. Once my model reaches the end of one path
> segment it gets handed the next one. So instead of one big path I
> divided it into the smallest possible chunks. That works, but it leads
> to the next problem: As the path segments are of different lengths,
> they make my models movement speed vary from segment to segment. But I
> think I will find a way to handle that.
> 
> Nethertheless I'm still curious why the PathAnimator doesn't work as
> it should (in my case). So if you, Fabrice, or anybody else has got an
> idea, I'd love to test it :) .
> 
> 
> On 3 Jun., 16:57, Fabrice3D <[email protected]> wrote:
>> 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