So what’s happening is I have variables set to easily change the orientation of a brick that functions as my game’s camera,
CamTest = function(CameraPart,OrX,OrY,OrZ,X,HEIGHT_OFFSET,CAMERA_DEPTH)
if HEIGHT_OFFSET == nil and CAMERA_DEPTH == nil then
HEIGHT_OFFSET = 4
CAMERA_DEPTH = 15
else
HEIGHT_OFFSET = HEIGHT_OFFSET
CAMERA_DEPTH = CAMERA_DEPTH
end
if OrX == nil then
OrX = -20
elseif OrX ~= nil then
OrX = OrX
end
if OrY == nil then
OrY = 0
elseif OrY ~= nil then
OrY = OrY
end
if X == nil then
X = 0
elseif X ~= nil then
X = X
end
local function updateCamera()
local character = player.Character
if character then
local root = character:FindFirstChild("HumanoidRootPart")
if root then
CameraPart.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position + Vector3.new(X,HEIGHT_OFFSET,CAMERA_DEPTH))*CFrame.Angles(math.rad(OrX),math.rad(OrY),0)
end
end
end
RunService:BindToRenderStep("Side", Enum.RenderPriority.Camera.Value + 1, updateCamera)
end,
When I change both my X and Y here
ShopCamModule.ShopCam(ShopCam,
-20, -- X Orientation
90, -- Y Orientation
0, -- Z Orientation
The Orientation property describes the part’s rotation in degrees around the X, Y and Z axes using a Vector3. The rotations are applied in Y → X → Z
as well as:
It is also worth noting how this property differs from the CFrame.Angles() constructor, which applies rotations in a different order (Z → Y → X). For better control over the rotation of a part, it is recommended that BasePart.CFrame is set instead.