I suggest you learn some vector math before doing this, It's always helpful ;)

Printable View

- 08-13-2003PotitKing
I suggest you learn some vector math before doing this, It's always helpful ;)

- 08-13-2003Silvercord
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 - 08-16-2003Zach L.Quote:

*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.