Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am very confused, is this an engine bug?

Someone explain this please

targetX = 0
while true do
	targetX += 1
	print(CFrame.Angles(math.rad(0), math.rad(0), math.rad(targetX)).LookVector)
	wait()
end

Output is always -0, -0, -1

targetX = 0
while true do
	targetX += 1
	print(CFrame.Angles(math.rad(0), math.rad(targetX), math.rad(0)).LookVector)
	wait(0.1)
end

Outputs are always changing here

targetX = 0
while true do
	targetX += 1
	print(CFrame.Angles(math.rad(targetX), math.rad(0), math.rad(0)).LookVector)
	wait(0.1)
end

Outputs are always changing here too

1 answer

This is not a bug. You are rotating on the same axis that the LookVector points to. The LookVector points to the direction the front of the CFrame is facing. Basically, it tells you where the front of the CFrame is facing and also, the direction the CFrame's Z axis in its local space is facing.

This is best explained with visualization though. Here's a part with a few attachments: one that points in the direction that the axes face (except the front one, since the LookVector points in the -Z direction). Here is the image link which shows each attachment and identifies them

In the following gif, the part gets rotated on the Z axis. Here is the gif

Notice how the front attachment doesn't move, but the others do, because you are rotating on the same axis that the lookvector points to. You also notice that this result is reflected when you rotate on the Z axis and obtain the LookVector of it. This is also true if you were to rotate on other axes and obtain the respective direction vector that the rotation axis points in.

For example, you can apply a rotation on the X axis, then obtain the RightVector and you notice that the result is the same, or when you apply a rotation on the Y axis, then obtain the UpVector and you also notice that the result is the same

This discussion is preserved as it was. New answers, comments, and votes are closed.