PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

SetRoll

This function sets the current roll, in radians, of the Camera. The roll is applied after the Camera/CFrame and represents the rotation around the Camera|Camera’s Z-axis.

For example, the following would invert the Camera:

workspace.CurrentCamera:SetRoll(math.pi) -- math.pi radians = 180 degrees

SetRoll has no effect on any roll applied using the Camera/CFrame property. Roll applied using SetRoll is not reflected in the Camera/CFrame property but is reflected in in the DataType/CFrame returned byCamera/GetRenderCFrame.

This function can only be used when the Camera/CameraType is set to ‘Scriptable’, regardless of whether the default camera scripts are being used. If it is used with any other Camera/CameraType a warning is given in the output.

Any roll applied using this function will be lost when the Camera/CameraType is changed from ’Scriptable’.

To obtain the roll set using this function use Camera/GetRoll.

As this function is outdated, you are advised to instead apply roll to the Camera using the Camera/CFrame property. For example:

local currentCFrame = workspace.CurrentCamera.CFrame
local rollCFrame = CFrame.Angles(0, 0, roll)
workspace.CurrentCamera.CFrame = currentCFrame * rollCFrame

Parameters

Name Type Default Description

The roll angle, in radians, to be applied to the Camera

Returns

Return Type Summary

No return