You’ve gotta set the sway and any other offsets (walking, aiming, etc) as an OFFSET of the viewmodel
For example:
viewmodel:SetPrimaryPartCFrame(camera.CFrame * walkingCF * swayCF * aimingCF)
Then just lerp the other values like walkingCF
and swayCF
for this i wouldve went on a different approach by getting how much the camera has rotated, lerping it, and adding an offset to the camera (which is what @Sensei_Developer suggested)
but if you really want it that way then…
the plan: lerp the cframe and remake a cframe with the lerped orientation but keep the original position
if loadout.current.PrimaryPart ~= nil then
local lerpedRot = loadout.current.HumanoidRootPart.CFrame:lerp(thing,0.2) -- you should use delta time instead of setting it to 0.2 if you want it to work on all framerates
local _,_,_,m11,m12,m13,m21,m22,m23,m31,m32,m33 = lerpedRot:components(); -- we grab the orientation values from the lerped cframe
local ogPos = thing.p; -- we get the position that was not lerped
local newCf = CFrame.new(ogPos.x,ogPos.y,ogPos.z,m11,m12,m13,m21,m22,m23,m31,m32,m33) -- reconstruct cf, we keep the orientation from the lerped cf but we keep the original position
loadout.current.HumanoidRootPart.CFrame = newCf; -- you won
end;
1 Like
I was so confused on how to get those components, thanks!