I am trying to make a simple humanoid-controlled first person VR game but I’m trying to make a custom controller, I have managed to disable movement with this script
local controls = game.Players.LocalPlayer.PlayerScripts:WaitForChild(“PlayerModule”):WaitForChild(“ControlModule”)
require(controls.TouchThumbstick):Disable()
but I have not managed to disable the right thumbstick which controls the camera by rolling and rotating it as shown below.
I have been looking for many hours on how to disable it to no luck.
Ideally it would be great if there was a way to disable ALL controller controls at once.
Disabling controls is intended to be done through the PlayerModule itself instead of directly through finding a child module. The GetControls method exists to return the controls registered through the PlayerModule and Disable is meant to disable controls.
local playerModule = require(game:GetService("Players").LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
playerModule:GetControls():Disable()
Shouldn’t you just disable the camera module then? I’m pretty sure that the ControlModule is completely unrelated to how the Camera behaves; ControlModule is intended for controlling how a character moves, while CameraModule is responsible for the camera both by implementing camera types and by setting the inputs needed to control it as well (panning, zooming, etc).
Solved! I commented this out inside the ClassicCamera module which handles the joystick camera movement.
if self.lastUpdate then
local gamepadRotation = self:UpdateGamepad()
if self:ShouldUseVRRotation() then
self.rotateInput = self.rotateInput + self:GetVRRotationInput()
else
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math.min(0.1, timeDelta)
if gamepadRotation ~= ZERO_VECTOR2 then
self.rotateInput = self.rotateInput + (gamepadRotation * delta)
end
local angle = 0
if not (isInVehicle or isOnASkateboard) then
angle = angle + (self.turningLeft and -120 or 0)
angle = angle + (self.turningRight and 120 or 0)
end
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(math.rad(angle * delta), 0)
end
end