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
9 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...

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

What do I need to do to make it local.

1 answer

Log in to vote
0
Answered by 9 years ago
1local 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 — 9y
Ad

Answer this question