My goal is to have a part oriented so the front face, faces the front point, the back face, faces the back point, and so on.
The images below are practically what I am trying to achieve, where each arrow represents a face and the corresponding color part the position it needs to face towards.
ㅤ
ㅤ
This is what I have below but I don’t know how to incorporate the left and right direction:
local back = workspace.Back.Position
local front = workspace.Front.Position
local left = workspace.Left.Position
local right = workspace.Right.Position
local center = (back + front + left + right) / 4
local fB = (front - back).unit
local lR = (right - left).unit
local up = Vector3.new(0, 1, 0)
local rightVector = fB:Cross(up).unit
local upVector = rightVector:Cross(lR).unit
local orientationCFrame = CFrame.fromMatrix(center, rightVector, upVector, -fB)
workspace.part.CFrame = orientationCFrame
Anything will help!