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

How do I detect if the player camera is looking up?

I'm scripting something dont want to talk a lot I'm gonna keep it simple so I want to print Camera is looking up if it is.

here is what I got

local camera = workspace.CurrentCamera
while wait(1) do
	if camera.CFrame.UpVector then
		print("Camera is looking up")
	end
end

1 answer

I'm not too sure about this but you can use the dot product

--quicc mafs
function UpOrDown(LookVector)
	local LookVector = LookVector.Unit
	local UpVector = Vector3.new(0, 1, 0)
	
	--Should return a value within range [-1, 1]
	return LookVector:Dot(UpVector)
end

1 comment

0

hey I've seen this code somewhere else so can you please explain it

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