Quick math question

Uhm, I am stuck in maths currently and need help:

Lets say I have the point A(0,0,0) and point B(2,2,5). And I have the direction from A to B. How do determine the point in space which is 3 units distance away from A and along this line A->B?

edit: I believe it must be something like getting the Normalized Direction from A to B and then multiplicate each of the Normalized (x,y,z) value with 3 and then Add all these points to A. I am not sure however if that is correct. Can’t find the appropriate chapter in vectors currently.

It sounds like you already know how to do it - have you tried the method you described to see if it works?

Anyway, assuming A and B are not coincident or nearly coincident:

Vector3 direction = B - A;
direction.Normalize();
Vector3 P = A + direction * distance;

Thanks for confirming (no I didn’t try it out yet) :slight_smile: