I recently saw that CFrame.new(v1,v2) for creating a look at CFrame was deprecated, so I attempted to implement the suggested alternative which I don’t understand in the slightest.
How in the world do you get a rotation matrix from 3 cross products which are essentially the area of the vector’s cube trapezoid thing?
I decided to disregard attempting to understand it and used it on my camera for a neat little menu effect. But jokes on me because using it results in the camera FOV being completely broken or the screen just turns black. How do I fix this?
function lookAt(eye, target) -- This is the function straight from the wiki
local forwardVector = (eye - target).Unit
local upVector = Vector3.new(0, 1, 0)
local rightVector = forwardVector:Cross(upVector)
local upVector2 = rightVector:Cross(forwardVector)
return CFrame.fromMatrix(eye, rightVector, upVector2)
end
workspace.CurrentCamera.CFrame = lookAt((CFrame.new(0,30,5) ).p,Vector3.new())
Results: Instead of looking at the part at 000, the screen looks like this…
Also, to specify, the Magnitude of the cross product of two vectors is the area of the parallelogram that the two vectors form, and the actual cross product of two vectors is a vector that is perpendicular to those two vectors
This appears to be a problem with the way you’re constructing the CFrame (But I’m not sure what the problem is if that makes sense).
This effect looks like something I’ve seen before and perhaps the information on this post may help you have some useful insight that solves or more clearly identifies the problem.
This effect seems to be created by mutating the camera’s rotation matrix.
Oh yeah this definitely looks like its probably the underlying cause. I’m not sure if this is the intended behavior that the engineers were expecting when this function was created and they decided to deprecate Cf.new(v1,v2).