Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get local Cframe angle of a camera?

Asked by
Myaxp 3
8 years ago

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

Log in to vote
0
Answered by 8 years ago
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.

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. Myaxp 3 — 8y
Ad

Answer this question