How to lengthen / extend a vector path?

If you have 2 points in 3D space, how do you extend the vector length to move one away from the other by a given amount, following the same vector path? Path is not related to world origin 0,0,0.

My attempts at subtraction, normalizing and multiplying are not working.

212977-extendvector.png

This should work:

2 Likes

BDC604 you could at least select this answer as accepted, he deserves it :]

This may help as well, in my example I have an actor(Fire Point) and I want to spawn a projectile a set distance from its forward vector(Projectile Offset)

.

To further explain the math here:

I get the actor’s current location through (Get world Transform) and get the actor’s forward vector. The forward vector outputs a value between -1 & 1 for each X, Y, & Z axis, essentially giving you a percentage of how close the actor is facing in that direction.

I multiply the absolute of the forward vector by the distance away from the actor I want to spawn my projectile.

I divide the forward vector by the absolute of the forward vector, giving me a positive or negative.

I then multiple the above two values together to create my extension vector.

I add my extension vector to my actors location equaling my new spawn location.

2 Likes