Camera CFrame Applying Character Velocity Reguardless of CameraType or CameraSubject

What Happens:
Whenever the camera’s CFrame is modified every render step it generates HumanoidRootPart velocity regardless of which CameraType or CameraSubject properties are set on the camera.

(The repro file below shows the movement of a camera in “Scriptable” CameraType mode being able to generate enough velocity to fling the character off the baseplate it’s standing on.)

Video:

(Notice the camera is being moved while in Scriptable mode but is still generating character velocity and flinging the spawned character causing them to die.)

Where It Happens:
I have tested and reproduced this bug both in studio and on live game servers.

Repro Place File:
Camera CFrame Bug Demo.rbxl (18.7 KB)

Repro LocalScript:

local runService = game:GetService('RunService')
local playerService = game:GetService('Players')

local player = playerService.LocalPlayer
local camera = workspace.CurrentCamera

local position = Vector3.new()

local function renderFrame()
	
	local distance = math.random(1,400)/100
	
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = CFrame.new(position + Vector3.new(0, distance, 0), position)
	
end

runService:BindToRenderStep('render', Enum.RenderPriority.First.Value, renderFrame)

(place in StarterPlayer - > StarterPlayerScripts)

Steps to reproduce:

  1. Open repro file (attached above)
  2. Play Solo or Publish and Test on a live Game Server
  3. Observe your health bar zeroing out as your character is flung off the baseplate by the movement of your camera’s CFrame
  4. If in studio, observe that the Camera object in the Workspace is set to the “Scriptable” CameraType

Follow up,

I did some digging in the Roblox Default PlayerScripts and found the culprit for the bug.

On line 344 in PlayerModule - > ControlModule, “calculateRawMoveVector” is called which uses the camera’s CFrame to manipulate the player without checking the CameraType of the CurrentCamera.

I was able to fix this bug by forking the playerscripts and adding an additional check to the calculateRawMoveVector function, returning the base value if the camera is in “Scriptable” mode.

Before: image
After:image

CC: @AllYourBlox

2 Likes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

Please note that filling a bug report does not guarantee that it will be fixed once triaged.

2 Likes