I suggest you learn some vector math before doing this, It's always helpful
I suggest you learn some vector math before doing this, It's always helpful
% gcc -v
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106
just to sum up what everyone said, first find the *speed* that you want to move this frame, then you find the direction you want to move in. The direction you want to move in has a length of one, therefore when you add the direction multiplied by speed you move speed units in the direction of your unit vector
float speed = 5;
Vector3 Direction = Vector3(1, 0, 0)
Direction's length is obviously one, when you multiply Direction by 5 you get
Vector3(5, 0, 0) therefore you move 5 units along the x axis
Here's one that's not so obvious
Vector3 Direction = Vector3(.707, 0, .707)
Direction has a length of 1
sqrt(.707^2+.707^2) = 1
Position = Position + (Direction * speed)
but the same idea works
Not quite... You got it backwards (granted, for finding the magnitude this doesn't matter, but for the direction vector it does).Originally posted by Azmeos
Ok, so
magnitude = sqrt(x^2+y^2+z^2);
where x, y and z are really x1-x2, y1-y2, and z1-z2 ?
It should be 'destination - current_location' (x2 - x1, etc...).
*edit*
I'd take PotitKing's advice. If you can't find sufficient resources online, then Dover publishes some good and inexpensive books on the subject.
Last edited by Zach L.; 08-16-2003 at 10:35 PM.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.