Getting the middle direction between 2 directions


I’m trying to achieve the red line.
Any help is nice and cool

You just add the two directional vectors and half it???

1 Like

I’m not that good with vector 3 math

For the middle direction regardless of size

(vec1.Unit + vec2.Unit).Unit

To weight them though just remove the .Units and divide by 2.

(vec1 + vec2)/2

Basically you are getting the average direction in the first one and the average vector in the second one.

1 Like

you don’t know what are vectors, it’s math


You can mess around with this code yourself

local vector1 = Vector3.new(10,0,10) -- a first vector
local vector2 = Vector3.new(10,0,0) -- a second vector
local vectorResult = vector1 + vector2 -- a summary of these vectors, will be represented as red

local part1 = Instance.new('Part', workspace)
part1.Anchored = true
part1.Size = Vector3.new(0.5, 0.5, vector1.Magnitude)
part1.CFrame = CFrame.new(vector1 / 2, vector1)
part1.BrickColor = BrickColor.Green()
part1.Transparency = 0.5

local part2 = Instance.new('Part', workspace)
part2.Anchored = true
part2.Size = Vector3.new(0.5, 0.5, vector2.Magnitude)
part2.CFrame = CFrame.new(vector2 / 2, vector2)
part2.BrickColor = BrickColor.Green()
part2.Transparency = 0.5

local partResult = Instance.new('Part', workspace)
partResult.Anchored = true
partResult.Size = Vector3.new(0.5, 0.5, vectorResult.Magnitude)
partResult.CFrame = CFrame.new(vectorResult / 2, vectorResult)
partResult.BrickColor = BrickColor.Red()

If vector lentgh is something you don’t want to take into consideration, add Vector3.Unit to all vectors

1 Like

Thank you @RatiusRat @tlr22 @MrSuperKrut for helping me

here is another option

local cFrame1 = CFrame.lookAt(Vector3.zero Vector3.new(0, 0, 1))
local cFrame2 = CFrame.lookAt(Vector3.zero Vector3.new(1, 0, 0))
local cFrame3 = cFrame1:Lerp(cFrame2, 0.5)
print(cFrame3.LookVector)
2 Likes