So currently I’m trying to lerp a CFrame C0 between 2 CFrames for an Aim Down Sight System.
I’ve already calculated the offset between the Aim Part in the tool and the center of the camera.
offsetx, offsety, offsetz determines the offset, in vector3.
I lerp the Tool, Left Arm and Right Arm independently, they’re inside a ViewModel.
This is what I did without lerping, ignore the order of XYZ values
char.Torso.ToolGrip.C0 = char.Torso.ToolGrip.C0 * CFrame.new(offsetX,offsetY,offsetZ)
ViewModelTorso["Left Shoulder"].C0 = ViewModelTorso["Left Shoulder"].C0 * CFrame.new(offsetZ,offsetY,-offsetX)
ViewModelTorso["Right Shoulder"].C0 = ViewModelTorso["Right Shoulder"].C0 *CFrame.new(-offsetZ,offsetY,offsetX)
This is the result with no lerping (code above), you can see the arms positioned correctly.
https://gyazo.com/0f549d0c85da57a0e19a7220c6905662
When I lerp the Tool, it works as intended.
delay(0,function()
for i = 0,1,0.05 do
char.Torso.ToolGrip.C0 = char.Torso.ToolGrip.C0:lerp(CFrame.new(offsetX,offsetY,offsetZ),i)
wait()
end
end)
However, it doesn’t work for the Left Arm and Right Arm. The ViewModel Rig is copied from the Roblox’s default R6 Rig.
delay(0,function()
for i = 0,1,0.05 do
char.Torso.ToolGrip.C0 = char.Torso.ToolGrip.C0:lerp(CFrame.new(offsetX,offsetY,offsetZ),i)
wait()
end
end)
delay(0,function()
for i = 0,1,0.05 do
ViewModelTorso["Left Shoulder"].C0 = ViewModelTorso["Left Shoulder"].C0:lerp(CFrame.new(offsetZ,offsetY,-offsetX),i)
wait()
end
end)
delay(0,function()
for i = 0,1,0.05 do
ViewModelTorso["Right Shoulder"].C0 = ViewModelTorso["Right Shoulder"].C0:lerp(CFrame.new(-offsetZ,offsetY,offsetX),i)
wait()
end
end)
This is the result, you can see Left Arm and Right Arm positioned wrong, but the tool positioned as intended.
https://gyazo.com/73a6abce8426988e167eed061d1ee4e9
How do I fix this? I just implemented lerping, nothing else though?