A vector in it's Slowest (or "simplest") form

9 views
Skip to first unread message

lin...@gmail.com

unread,
May 7, 2008, 1:53:35 AM5/7/08
to APE General
As you know a vector shows direction and distance, but how do i cut
the distance down to its simplest form for every variable?
im using the current code to add force right now, and i would really
like it so that the bAr[bNo] goes at the same speed everytime.

Code:
bAR[bNo].addForce(new VectorForce(false, (mouseX - mainCharacter.px)/
5, (mouseY - mainCharacter.py)/5));
btw the /5 is to slow the projectile when the mouse is really far away
from the player

lin...@gmail.com

unread,
May 8, 2008, 2:34:52 AM5/8/08
to APE General
lol bump?
but uhm right now to keep it constant...er im keeping the X value as
1...
Please help thanks

lin...@gmail.com

unread,
May 8, 2008, 2:36:46 AM5/8/08
to APE General
nvm X as 1 doesnt work lmao soz

lin...@gmail.com

unread,
May 8, 2008, 5:30:01 AM5/8/08
to APE General
Ok i've figured it out with some help from someone from the B2d forums
you just divide you X & Y values by the length of the vector
Reply all
Reply to author
Forward
0 new messages