After playing around with third person cameras today, I noticed Humanoid.CameraOffset has some really strange inconsistent behaviour between studio and game. At least I think it’s the cause as it is so far the only thing that changes how the camera is positioned.
Put simply if feels like the camera’s rotation lags behind the character in studio, but in game it seems to keep up almost perfectly fine. It’s nothing major, and to be quite honest I’m not even sure if it’s a bug or not, but it really makes doing any kind of testing between studio and a published game hard when I can’t have the same camera behaviour between the two.
Here is a place with the following code to handle the third person camera.
local input = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local stepped = game:GetService("RunService").RenderStepped
local camera = workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
player.CameraMaxZoomDistance = 5
player.CameraMinZoomDistance = 5
player.CameraMode = "LockFirstPerson"
stepped:connect(function()
local look = camera.CoordinateFrame.lookVector
local pitch = math.asin(look.Y)
humanoid.CameraOffset = Vector3.new(1.5, -math.sin(pitch) * 5, math.cos(pitch) * 5)
for _, obj in next, character:GetChildren() do
if obj:IsA("BasePart") then
obj.LocalTransparencyModifier = 0
elseif obj:IsA("Hat") then
obj.Handle.LocalTransparencyModifier = 0
end
end
end)
Anybody have any sort of clue what might be going on? I’d be interested in a little input to the whole situation.