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

How to get local Cframe angle of a camera?

Hi.

This script gets deltas from the mouse, insert math into camera.CFrame along with collected deltas and make the camera angles move.

But it moves on the global axis...

local function GetMouseMovement()
	return xangle, yangle, 0
end
game:GetService("RunService").RenderStepped:connect(function()
	local mousemovement = GetMouseMovement()
	local HeadPosition = game.Players.LocalPlayer.Character.Head.Position
	camera.CoordinateFrame = CFrame.new(HeadPosition)
	camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(-yangle), math.rad(-xangle), 0)-- needs 2 be local
end)

What do I need to do to make it local.

1 answer

local CF = game.workspace.CurrentCamera.CFrame print(CF)

Position your camera to what you want the cframe angels to be. Run this in the command bar and you should get a bunch of values in the output. I hope this is what you're asking for.

1 comment

0

no... What I have the delta of the mouse doing the angle work. My question is how do I turn that for local angles to rotate the camera.

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