Hello,
I am trying to path-animate an object ( i tried several types of
objects so i'm pretty sure the problem is in my path data )
Here is what i am doing
//initialise scene,private variables etc
setupAnimator
{
var colorCodeSpheres:Array =
[
"red",
"pink",
"orange",
"yellow"
]
var aPath:Array =
[
new Number3D( -5000, -5000, -10000),
new Number3D( -5000, 5, 5),
new Number3D( 5000, 5, 5),
new Number3D( -5000, -4000, -10000)
]
var p:Path = new Path(aPath);
var n:Number3D;
for (var i = 0; i < aPath.length;i++)
{
n = Number3D(aPath[i]);
this.view.scene.addChild(
new Sphere(
{ x:n.x,
y:n.y, z:n.z, material:new ColorMaterial(colorCodeSpheres[i]) }
));
}
var animInit:Object =
{
duration:5000,
lookat:false,
aligntopath:true,
targetobject:null,
offset:new Number3D(0, 100, 0),
rotations:null,
fps:30,
easein:false,
easeout:false
}
this.testCube = new Cube( { material:new
WireframeMaterial("red#purple"), height:500, width:500, depth:500 } );
this.view.scene.addChild(this.testCube);
this.pathanimator = new PathAnimator(p,
this.testCube,animInit);
}
}
onEnterFrame ()
{
if(pathanimator)
{
this.pathAnimTime = (this.pathAnimTime
+0.001>1)? 0 :
this.pathAnimTime+0.001;
this.pathanimator.update(this.pathAnimTime);
}
//at pathAnimTime = 499.000 (the 3rd Point in the path) :
//TypeError: Error #1009: Cannot access a property or method of a null
object reference.
// at away3d.animators::PathAnimator/::updatePosition()
// at away3d.animators::PathAnimator/update()
// at ColladaAnimation/::onEnterFrame()
}
I tried debugging it, and it appears that the end variable of the
curve is null, but i am confused as to why.
Any help greatly appreciated!