So just to be clearer, I mean the Vector3 such as mouse.Hit.lookVector.
You can accomplish this by adding the two vectors together and taking the unit of that vector.
Note: The following works when the vectors are perpendicular, as well as any case other than the special cases. You will have to do additional checks if you need to verify that the vectors are perpendicular before using this method.
local Vector1 = Vector3.new(0,1,0) -- First LookVector local Vector2 = Vector3.new(0,0,1) -- Second LookVector local NewVector = (Vector1 + Vector2).Unit -- Vector in the middle of the two
Special Case
Certain vector combinations, such as adding zero vectors and vectors looking in opposite directions, are impossible to find the unit of. Attempting to do so will return:
Vector3.new(NaN,NaN,NaN)
This can cause parts to do strange things such as disappearing, therefore it is important to check if your vector is NaN (Not a Number) before you use it. You can do this with the following:
local ImpossibleVector = Vector3.new(0,0,0).Unit ImpossibleVector = ImpossibleVector.X == ImpossibleVector.X and ImpossibleVector or Vector3.new(0,0,0);
Because NaN is the only number that does not equal itself (NaN ~= NaN), you can check if a component of the vector is equal to itself. In line 2 I check if the X component of the vector is equal to iself, returning the vector if it is, if not returning a zero vector.
Special cases that result in NaN vector.
Vector3.new(0,0,0) + Vector3.new(0,0,0) -- Adding zero vectors Vector3.new(0,1,0) + Vector3.new(0,-1,0) -- Vector looking straight up + Vector looking straight down