PDA

Click to See Complete Forum and Search --> : Smooth motion



Zakarus2001
04-26-2002, 09:40 AM
Okay say i have an "orb" that seeks something, i would rather have it go in a curved motion rather than a strait path toward it, I am not quite sure of the exact coding, but i know it would be something like this...



onClipEvent(EnterFrame){
this._x += Math.sin(_x - objectToBeSeeked._x/180);
this._y += Math.sin(_y - objectToBeSeeked._y/180);
}

I know somewhere in there I need to have Math.PI and maybe i need cosine, but I am not the greatest in Trig(i haven't done any radian conversions for almost 2 years now) but ahh I am sure you guys in here just laugh at this kind of Question... well thx for reading!

~Zakarus2001


[Edited by Zakarus2001 on 04-26-2002 at 11:38 AM]

bit-101
04-26-2002, 11:47 AM
you have your basic easing equation to go straight towards a target:

this._x+=(targetx-this._x)/5;
this._y+=(targety-this._y)/5;

5 being an arbitrary number to control speed.

try using different numbers for the x and y components. instead of 5 and 5, try 2 and 10.

Zakarus2001
04-26-2002, 02:56 PM
I guess i was making that a bit too hard, lol well thx and thx again...:):):);):):):):):):):):):););););)

~Zakarus2001