Here is the code i am using...
public function initObjects():void
{
//how fast the object is moving
this.speed = 0.0025;
loader2 = Collada.load(meshes +
"20_cat_smooth_bake_channel.dae",
{ material:new BitmapFileMaterial(textures + "20_cat.png"), scaling:
1.00 } );
loader = Collada.load(meshes +
"20_cat_smooth_bake_channel.dae",
{ material:new BitmapFileMaterial(textures + "20_cat.png"), scaling:
1.00 } );
loader2.addOnSuccess(onLoaderSuccess2);
loader.addOnSuccess(onLoaderSuccess);
this.view.scene.addChild(loader);
this.view.scene.addChild(loader2);
}
private function onLoaderSuccess(event:LoaderEvent):void
{
this.Model = event.loader.handle as ObjectContainer3D;
//same path
var aPath:Array =
[
new Number3D(-1000, 0, -1000),
new Number3D(0, 200, 0),
new Number3D(1000, 400, 1000),
new Number3D( 3000, 600, 4000),
new Number3D( 6000, 800, 9000),
new Number3D(6000, 3000, 16000)
]
this.path = new Path(aPath);
this.pathAnimator = new PathAnimator(this.path,
this.Model,
animInit); //animInit is a constant object
}
private function onLoaderSuccess2(event:LoaderEvent):void
{
this.Model2 = event.loader.handle as ObjectContainer3D;
var aPath:Array =
[
new Number3D(-1000, 0, -1000),
new Number3D(0, 200, 0),
new Number3D(1000, 400, 1000),
new Number3D( 3000, 600, 4000),
new Number3D( 6000, 800, 9000),
new Number3D(6000, 3000, 16000)
];
this.path2 = new Path(aPath);
this.pathAnimator2 = new PathAnimator(this.path2,
this.Model2,
animInit);
}
A partial stack trace for the error I am getting is:
TypeError: Error #1010: A term is undefined and has no properties.
at away3d.animators::PathAnimator/update()
at away3d.animators::PathAnimator$iinit()
at Main/::onLoaderSuccess2()
On Dec 7, 2:08 am, cellis <[EMAIL PROTECTED]> wrote:
> Hey Fabrice,
>
> thanks for the response. I have tried using a different path for each
> object, but still get errors. Can you provide a working example using
> multiple objects, each with it's own path and Path Animator?
>
> On Dec 6, 8:15 pm, Fabrice <[EMAIL PROTECTED]> wrote:
>
> > Yes there are many ways to to animate more objects sharing the same
> > path info and even same PathAnimator instance.
> > here some possible answers for you:
>
> > you can place more items along the path and animate them, just using the
> > getPositionOnPath( p:Number3D, t:Number)
>
> > or like you do, making more PathAnimator instances, except in your
> > code you declare twice the path.
> > just declare it once and you should be fine. since you do not update
> > the path, you even can pass just a new path(aPath)
> > to the constructor. and yes you need in this case to update in
> > enterframe each instance PA.
>
> > or if you do not wish to make more instances PA,
>
> > just set the target to the path before updating it. (and eventually
> > the props you want for that object)
>
> > like here for instance this could be 3 wagons of a train...using the
> > same PA instance.
> > PA.targetobject(wagon#1)
> > PA.update(0.25);
>
> > PA.targetobject(wagon#2)
> > PA.update(PA.time - 0.05);
>
> > PA.targetobject(wagon#3)
> > PA.update(PA.time + 0.05);
>
> > now if you want to have more paths, then you need to make more PA
> > instances, each with own Path,
> > or just one PA and swap Path instances and set them to the PA. Since
> > you will have to update all targets etc, I think multiple PA's would
> > be better in this case.
>
> > Fabrice
>
> > On Dec 6, 2008, at 7:08 PM, cellis wrote:
>
> > > Hey guys,
>
> > > Is there support for multiple path animations? I am trying to path
> > > animate two objects in my scene but the second object pathAnimator
> > > always has a rotations property that is not null, where it should be
> > > null. This is causing the path Animator to break on update().
>
> > > I have attached my source code here:
>
> > >http://groups.google.com/group/away3d-dev/web/TestMultiplePathAnimato...
>
> > > Any ideas?