CFrame.LookAlong

Super confused on what CFrame.lookalong does, at first i assumed that by “looking along a vector” it meant that these two vectors would be next to each other(non intersecting) while also pointing towards the same direction, but it seems to do the same thing as CFrame.lookat

I does the same thing as CFrame.lookAt, almost

The first vector is the origin
The second vector is the direction to look at (like a LookVector). With CFrame.LookAt, the second vector is the position to look at.

If you change the origin, it will still look in the same direction. In the case of CFrame.LookAt, the direction it looks at will change, to keep looking at position

local Origin = Vector3.new(4,0,0)
local Direction = Vector3.new(1,0,2).Unit -- Unit is probably not needed, but directional vectors usually are unit vectors
local LookPosition = Origin + Direction

local CFrame1 = CFrame.lookAlong(Origin, Direction)
local CFrame2 = CFrame.lookAt(Origin, LookPosition)
-- These two CFrames should be the same
5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.