generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Rescripting the camera

Previous Thread :: Next Thread 
Isosta is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image