I have made a First Person camera type for one of my projects and I have noticed the camera is stuttering… (I think that’s what you call it)
Do I use NetworkOwnership?
Video Example:
Here is script:
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
Player.CameraMode = Enum.CameraMode.LockFirstPerson
Camera.FieldOfView = 90
Humanoid.CameraOffset = Vector3.new(0, 0, -1)
for ChildIndex, Child in pairs(Character:GetChildren()) do
if Child:IsA("BasePart") and Child.Name ~= "Head" then
Child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
Child.LocalTransparencyModifier = Child.Transparency
end)
Child.LocalTransparencyModifier = Child.Transparency
end
end
Can you try turning off Humanoid.AutoRotate? I had a similar problem but with a 3rd person camera, my character (not camera) was stuttering a lot with AutoRotate set to true.
Oh you should be able of fixing that by manually changing the HumanoidRootPart CFrame every frame to point towards the camera’s LookVector. Let me know if you don’t know how to do it.
Sure! Here, I will put comments so you can see what each line of code does:
local Camera = workspace.CurrentCamera; -- we get the camera
local Character = game.Players.LocalPlayer.Character; -- player's character
local Humanoid = Character:WaitForChild("Humanoid"); -- character's humanoid
local RootPart = Character:WaitForChild("HumanoidRootPart"); -- character's humanoidrootpart
game:GetService("RunService").RenderStepped:Connect(function()
Humanoid.AutoRotate = false; -- set to false every frame to make sure it is locked otherwise the stutter will occur again
local CameraLook = Camera.CFrame.LookVector; -- we get the camera's lookvector which you can say is the direction it is pointing at
local RootPosition = RootPart.Position; -- we get the humanoidrootpart's position as we want to keep the player to the same position as they are currently
local RootToCamera = RootPart.Position + Vector3.new(CameraLook.X, 0, CameraLook.Z); -- we construct the vector3 that will make the new humanoidrootpart direction. We don't change the Y axis as that would rotate the character vertically and I don't think you want that
local LookAt = CFrame.lookAt(RootPosition, RootToCamera); -- we use CFrame.lookAt to construct our new humanoidrootpart's cframe. The first parameter is the position we want the humanoidrootpart to be at, so its current position, and the second parameter is the direction we want it to point at which we calculated before
RootPart.CFrame = LookAt; -- now we set the cframe!
end);
This code works perfectly for me, not sure if it will work fine too for you as i’ve never used it with LockFirstPerson before.