Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 25 Nov 2015 12:11 PM |
due to boredom. Apparently I suck at math. I can get the vertical and horizontal camera directioning to work seperately, but when used together, it tilts the camera as if you were tilting your head. Which I don't want to happen at all. It's first person only for now because that's all that I need
local Client = game.Players.LocalPlayer local Camera = game.Workspace.CurrentCamera
local GlobalSensitivity = 1 local LocalSensitivity = 1
local UserInputService = game:GetService("UserInputService") local RunService = game:GetService('RunService') UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local cameraAngle = CFrame.Angles(0,0,0)
UserInputService.InputChanged:connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then print(cameraAngle.X,cameraAngle.Y,cameraAngle.Z) cameraAngle = cameraAngle * CFrame.Angles(math.rad(GlobalSensitivity * LocalSensitivity * -inputObject.Delta.Y),math.rad(GlobalSensitivity * LocalSensitivity * -inputObject.Delta.x),0) end end)
RunService.RenderStepped:connect(function() if Client.Character then Camera.CoordinateFrame = Client.Character:FindFirstChild('Head').CFrame * cameraAngle end end) |
|
|
| Report Abuse |
|