New RootCamera script doesn't take "Scriptable" mode into account

--Line 452 in MainCamera.RootCamera script

	-- there are several cases to consider based on the state of input and camera rotation mode
	function this:UpdateMouseBehavior()
		-- first time transition to first person mode or shiftlock
		if isFirstPerson or self:GetShiftLock() then
			pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
			if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
				UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
			end
		else
			pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
			if isRightMouseDown or isMiddleMouseDown then
				UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
			else
				UserInputService.MouseBehavior = Enum.MouseBehavior.Default
			end
		end
	end

This piece of code (and probably others) still work even when camera type is set to “Scriptable”. This is not how Scriptable type used to work.

Scriptable type should not lock the mouse and release it which is literally the point of it.

I just spent 2 hours checking every single piece of camera mouse code that I have, only to find out that Roblox forgot about their own features.

12 Likes

This should be fixed now, but anyone who has made a copy of any older version of the CameraScripts in StarterPlayerScripts will not have the fix automatically. The changes made to address this specific issue are in CameraScript and RootCamera.

Also, just so as not to cause any confusion, there is no “New RootCamera”, per se. It’s not the RootCamera file that lost code related to Scriptable, but rather a flag we turned on that has made CameraScript use the ScriptableCamera module script in place of the old C++ implementation of Scriptable. The ScriptableCamera module overrides the Update() function of RootCamera, but things have been added to RootCamera over the years that affect every module that inherits from it. When we switched from using C++ to Lua camera control code, we discovered ScriptableCamera inherits and fails to override a couple of behaviors from RootCamera that it properly should not. These have been patched in a sort of quick-fix way because we’re just about to release a refactored and restructured set of Camera and Control scripts that don’t inherit this problem. RootCamera in particular evolved organically over the years, becoming more than the base class it was originally intended to be.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.