What is the difference between CFrame.new and CFrame.LookAt?

From what I understand, both take in a position and a point to lookAt. I understand that you can create a CFrame without setting the rotation with the first one, but if so, what is the point of CFrame.LookAt?

1 Like

I’m pretty sure lookAt has something to do with the direction it is facing, while new() just returns a position

CFrame.lookAt is newer. CFrame.new(pos, lookAt) existed before it. I believe one reason for the addition of CFrame.lookAt was better readability.

Another difference is that CFrame.lookAt() has a third parameter up that affects the result. While the default value which is Vector3.yAxis which is also the up vector used in CFrame.new(pos, lookAt) is the desired up vector in most cases, the up parameter of CFrame.lookAt() can sometimes be useful.

LookAt is for Facing a set direction, whilst .new is simply a position.

Functionally, CFrame.new can act like CFrame.lookAt. The major difference is that CFrame.new can do basically everything with CFrames, while the specific functions are better for their specific uses (ie. .lookAt for facing CFrames, .fromOrientation for angle adjustments, etc.)

CFrame.new, in most cases, wont return a CFrame with an orientation, but (to clear out some kind of incorrect responses here) in the case of CFrame.new(pos, lookAt), it does. CFrame.new() just has many many ways it can be used

Here is your answer when comparing CFrame.new(pos, lookAt) with CFrame.lookAt. I recommend using CFrame.lootAt() as it is more readable