Create a 3rd vector based off the first 2

I have two vector, X and Y. I want my 3rd vector, Z, to be offset by an arbitrary number that produces a vector that still aligns with X and Y.

I have tried X-Y or X+(X-Y).Unit, but i clearly dont know vector math like i thought i would.

Any help is appreciated

By this do you mean that if you draw a line between X and Y, the Z vector will fall somewhere on that line?

This can easily be done using linear interpolation (the :Lerp() method)

local X: Vector3 = Vector3.new(1, 2, 3)
local Y: Vector3 = Vector3.new(4, 5, 6)
local Z: Vector3 = X:Lerp(Y, math.random())
1 Like

Oh my bad, i didnt mean a lerp. I want this 3rd point to EXCEED either the first or second. yet still be parallel.

IE XYZ or ZXY when you draw the line through them all

Then you can still use lerp for that. The alpha value just needs to be greater than 1 or less than 0.

1 Like

I didnt know alpha can exceed or be less than 1. Ill brb to try this

EDIT: worked like a charm!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.