I am making system where I use the actual limbs of the character as the view model in first person. I have successfully been able to attach the limbs to the camera in first person, complete with FPS sway, walking bobbing, etc.
The problem is, the way I’ve been attaching the R6 left and right arms to the camera is by manually inputting an offset from the camera. All code below is running on a RenderStepped Loop. This is what it looks like:
LeftArm.CFrame = camera.CFrame + camera.CFrame.RightVector*1.5 + camera.CFrame.UpVector*-1.5
Now this works, but I’m afraid that because I’m not basing the offset off of the shoulder joint’s C0 or C1 value, it’s causing inconsistencies when I throw in the animation data. See below.
-- add the animation data
local animationcf = LeftShoulder.Transform -- cframe value of the changing offset caused by a playing animation
LeftArm.CFrame = camera.CFrame * animationcf + camera.CFrame.RightVector*1.5 + camera.CFrame.UpVector*-1.5
The above code causes the arms to apply the current animation improperly. This is likely because the animation transform cframe I am trying to add is rotating and moving the arm relative to the pivot point (the C0 and C1 values of the joint) while I am rotating it based on the center point of the arm. See picture below how the right arm’s tool animation is rotating from the center and not from the correct pivot point.
What I’m trying to do is to add the animation transform CFrame relative to the motor6D’s pivot point, and I’ve looked everywhere and cannot figure it out. Further, I can’ figure out how to find the joint’s pivot point based on the C0 and C1 values (most likely involves converting it to world space but I couldn’t get CFrame:ToWorldSpace() to do what I want.