-
What do you want to achieve?
I want to set the CFrame of the shoulders so that they would look like a viewmodel.
(Similar to R2DA if anyone remembers that classic) -
What is the issue?
Instead of the arms being “locked” to the camera, they jitter whenever I move the camera side to side.
-
What solutions have you tried so far?
I tried looking for answers on the forums, different ways of setting the cframe and using heartbeat (which did fix the side ways issue, but made looking up and down jitter) and a combination of heartbeat for horizontal rotation and renderstepped for vertical rotation, but the issue persisted as it seems to be tied to which update function the cframe is being set in.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function onRenderStepped()
cameraCFrame = camera.CFrame
updateFirstPerson()
firstPersonChanged()
local torsoX,torsoY,torsoZ = torso.CFrame:ToEulerAnglesXYZ()
local cameraX,cameraY,cameraZ = cameraCFrame:ToEulerAnglesXYZ()
local torsoCFrame = CFrame.new(torso.CFrame.Position) --* CFrame.Angles(0,torsoY,0)
if isFirstPerson then
local tool = character:FindFirstChildOfClass("Tool")
if tool then
rightShoulder.C0 = torsoCFrame:inverse() * (cameraCFrame * CFrame.Angles(0,math.rad(90),0) * CFrame.new(0,-1,1))
leftShoulder.C0 = torsoCFrame:inverse() * (cameraCFrame * CFrame.Angles(0,math.rad(-90),0) * CFrame.new(0,-1,1))
else
rightShoulder.C0 = CFrame.new(1, 0.5, 0) * CFrame.Angles(0, math.pi/2, 0)
leftShoulder.C0 = CFrame.new(-1, 0.5, 0) * CFrame.Angles(0, -math.pi/2, 0)
end
end
end
Thank you for reading and at least considering helping!