http://groups.google.com/group/away3d-dev/browse_thread/thread/560f0aef0d5a0e8
dont worry i read before posting this time ;d
the thing is that i must be doing something horrifying with the
funcionts, the scheme of my code is this:
public class away2 extends Sprite
{
here i declare the pathanimator,aPath,path,bolaand inito like i
described before
public function away2()
{
init();
}
private function init():void
{
initEngine();
initMaterials();
initObjects();
initListeners();
initMovimiento();
}
/*insert crappy code :d)*/
private function initObjects():void{
scene.addChild(bola);
pathanimator = new PathAnimator(path,bola,inito);
//here i could use the pathanimator.update, but i got null
object error.
//instead im using this, but the ball disappears (?)
var time:Number = 0;
time = (time +0.001>1)? 0 : time+0.001;
pathanimator.update(time);
/*more mediocre code*/
}
/*around 3k noob lines*/
private function onEnterFrame(event:Event):void{
//this line shouldnt matter but anyway here it goes
view.camera.lookAt(bola.position);
}
}
but as i said, or i get null error or the ball dissapears...
On 13 jul, 14:13, desgraci <[email protected]> wrote:
> i was but i got a null object error, dunno why
>
> private var pathanimator:PathAnimator;
> private var aPath:Array = [
> new Number3D(-5000, -5000, -10000),
> new Number3D(-5000, 0, 0),
> new Number3D(5000, 0, 0),
> new Number3D(5000, 5000, -10000),
> ];
> private var path:Path = new Path(aPath);
> private var bola:Sphere = new Sphere();
> private var inito:Object = {duration:5000,
> lookat:false,
> aligntopath:true,
> targetobject:null,
> offset:new Number3D(0,100,0),
> rotations:null,
> fps:24,
> easein:false ,
> easeout:false};
>
> scene.addChild(bola);
> pathanimator = new PathAnimator(path,bola,inito);
> pathanimator.update(0.5);
>
> On 13 jul, 14:04, Fabrice3D <[email protected]> wrote:
>
> > why don't you try the PathAnimator?
> > Its specially designed to do exactly this!
>
> > Fabrice
>
> > On Jul 13, 2009, at 7:45 PM, desgraci wrote:
>
> > > ok, im confused cause the away3d system has a y for z axis, so i was
> > > tryng to make a directional tweener in a 3d space, and several issues
> > > came up,
>
> > > public function animacion1():void{
> > > var rx:Number= new Number(Math.round(Math.random() *
> > > (10000)) -5000);
> > > var ry:Number= new Number(Math.round(Math.random() *
> > > (10000)) -5000);
> > > var rz:Number= new Number(Math.round(Math.random() *
> > > (10000)) -5000);
> > > var rt:Number= new Number(Math.round(Math.random() *
> > > (200))
> > > -100);
> > > var randomangle0:Number= new Number((Math.pow(rx,2)+Math.pow(rz,
> > > 2)+Math.pow(ry,2)));
> > > var randomangle1:Number= new Number(Math.round(Math.sqrt
> > > (randomangle0)));
> > > var randomangley:Number=new Number(Math.round(Math.acos(ry/
> > > randomangle1)));
> > > var randomanglez:Number=new Number(Math.round(Math.acos(rz/
> > > randomangle1)));
> > > var randomanglex:Number=new Number(Math.round(Math.acos(rx/
> > > randomangle1)));
>
> > > Tweener.addTween(model,{time:rt/10,rotationY:((randomangley*360)/
> > > 3.14159265358979)
> > > ,rotationZ:((randomanglez*360)/3.14159265358979),rotationZ:
> > > ((randomanglez*360)/3.14159265358979)});
>
> > > trace("movimiento1");
> > > Tweener.addTween(model,{delay:rt/10,time:(9*rt/
> > > 10),x:rx,z:rz,y:ry,onComplete:animacion2});
> > > }
>
> > > i just dont get that the model point to the place it goes, i have
> > > tried several combinations, but not luck, also the rotation is well,
> > > overreacted (not in speed but in spins), and the delays between
> > > animation 1 and 2 takes waayyy too much time (anim1=anim2 expect for
> > > the onComplete ofc)..., how can i fix this?