Hi, I am creating a VR game, and making a function to "snap" the camera to a certain rotation. For some reason it's rotating around a point, making the camera go in a very weird way. Here's the code I currently have:
InputService.InputChanged:Connect(function(input, gameprocessed)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.Thumbstick2 then -- Rotating (right controller)
local joystickPos = input.Position
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local rightControllerCFrame = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
if joystickPos.X < -0.5 then -- left
if not joystickDebounce then
joystickDebounce = true
camera.CFrame = camera.CFrame*CFrame.Angles(0,math.rad(30),0)
end
elseif joystickPos.X > 0.5 then -- right
if not joystickDebounce then
joystickDebounce = true
camera.CFrame = camera.CFrame*CFrame.Angles(0,-math.rad(30),0)
end
else
joystickDebounce = false
end
end
end
end)
Here's an example of how it looks: https://youtu.be/5m_DmPPm9Ac
