PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetRoll

This function returns, in radians, the current roll applied to the Camera using Camera/SetRoll. Roll is defined as rotation around the Camera|Camera’s Z-axis.

This function only returns roll applied using the Camera/SetRoll function. Roll manually applied to the Camera|Camera’s Camera/CFrame is not accounted for. To obtain the actual roll of the Camera, including roll manually applied, you can use the following snippet:

local function getActualRoll()
	local camera = workspace.CurrentCamera

	local trueUp = Vector3.new(0, 1, 0)
	local cameraUp = camera:GetRenderCFrame().upVector

	return math.acos(trueUp:Dot(cameraUp))
end

Returns

Return Type Summary

The current roll applied by Camera/SetRoll, in radians


Code Samples


Camera:GetRoll

This example, when used in a /LocalScript, will retrieve the current roll of the camera in degrees. Then, if the camera roll angle is not 20 degrees, the camera roll angle is set to 20 degrees.