I’m trying to calculate the plane a vehicle is currently travelling on and align it so it’s parallel to it.
Current behaviour
Everything seems to behave as expected when the Vehicle’s pitch is less than 90 degrees.
But when it surpasses that it behaves incorrectly.
How I calculate the plane
function Vector3ToPlane(VectorA, VectorB, VectorC)
local Plane_Right, Plane_Up, Plane_Look, Plane_Center
local VectorBC
VectorBC = (VectorB + VectorC) / 2
Plane_Center = (VectorBC + VectorA) / 2
Plane_Right = (VectorB - VectorC).Unit
Plane_Look = (VectorBC - VectorA).Unit
Plane_Up = Plane_Right:Cross(Plane_Look).Unit
return CFrame.fromMatrix(Plane_Center, Plane_Right, Plane_Up, Plane_Look)
end
The behaviour I’m trying to get