Hello, devs! I’m working on a system that uses player’s arms as a viewmodel to save work on viewmodels and stuff, everything works fine, but when you move the camera, the arms move “choppily” or “lag”.
Here’s footage of that happening :
and here’s the simplified code with explanations of each variable :
--[[
upperTorso - Upper torso of player
right/left Shoulder - Right and left shoulder
camera - Current camera
]]--
local newRightShoulder = upperTorso.CFrame:ToObjectSpace(camera.CFrame) * CFrame.new(1,-1,0)
local newLeftShoulder = upperTorso.CFrame:ToObjectSpace(camera.CFrame) * CFrame.new(-1,-1,0)
rightShoulder.C0 = newRightShoulder
leftShoulder.C0 = newLeftShoulder
1 Like
Use RunService:BindToRenderStep()
with the priority Enum.RenderPriority.Camera.Value + 1
.
Use Tween or Lerp
local newRightShoulder = upperTorso.CFrame:ToObjectSpace(camera.CFrame) * CFrame.new(1,-1,0)
local newLeftShoulder = upperTorso.CFrame:ToObjectSpace(camera.CFrame) * CFrame.new(-1,-1,0)
rightShoulder.C0 = rightShoulder.C0:Lerp(newRightShoulder, 0.1)
leftShoulder.C0 = leftShoulder.C0:Lerp(newLeftShoulder, 0.1)
Don’t want to because I want to make my own swaying system.
Lerp just makes it smoother? I don’t know what do you want to achieve then.
I want it to stay still so I can apply bobbing and swaying myself.
This sadly didn’t work. Also it only happens in first person.
I had this problem too and the way I fixed it was to:
-
Have a viewmodel with a Right Arm that has a RightGrip Motor6D in it
-
Clone the tool
-
Hide the original tool
-
Weld the clone to the RightGrip Motor6D of my viewmodel
-
Every RenderStep, set the Transform property of the viewmodel’s RightGrip to the character’s RightGrip