itzeclipsee
(JoeSwansoinVlogLive)
September 26, 2026, 2:17am
1
how would i go about making something like this? when you move your camera around, the viewmodel follows it and stays there rather than moving back to the center like how a sway effect would work (ie. when i move my camera down, the gun points down and only starts pointing somewhere else when i move my camera away). i’d assume it’s just calculating how far to the sides you move your camera and then adding that to the viewmodel but apparently i forgot everything about cframe yay
game is retrograd
2 Likes
UQGoose
(UAGoose)
September 26, 2026, 8:29am
2
It seems like effect is made by setting viewmodel’s orientation parralel to camera’s orientation.
(perhaps with some limits or weights)
Combined with springy / inertia logic to make it feel smoother.
Try something in style of:
local currentPitch = 0
local currentYaw = 0
local currentRoll = 0
local velocityPitch = 0
local velocityYaw = 0
local velocityRoll = 0
local stiffness = 20
local damping = 0.8
local weight = 0.5
local function updateSpring(current, velocity, target, dt)
velocity += (target - current) * stiffness * dt
velocity *= math.exp(-damping * dt)
current += velocity * dt
return current, velocity
end
local function updateViewmodel(dt)
local pitch, yaw, roll = camera.CFrame:ToOrientation()
-- Camera's rotation becomes the target
local targetPitch = pitch * weight
local targetYaw = yaw * weight
local targetRoll = roll * weight
-- Spring towards target
currentPitch, velocityPitch =
updateSpring(currentPitch, velocityPitch, targetPitch, dt)
currentYaw, velocityYaw =
updateSpring(currentYaw, velocityYaw, targetYaw, dt)
currentRoll, velocityRoll =
updateSpring(currentRoll, velocityRoll, targetRoll, dt)
local cameraRotation = CFrame.Angles(
currentPitch,
currentYaw,
currentRoll
)
viewmodel:PivotTo(
CFrame.new(camera.CFrame.Position)
* cameraRotation
* VIEWMODEL_OFFSET
)
end
RunService.RenderStepped:Connect(updateViewmodel)
You might also want to implement some limits for prettier results. Let me know if it was helpful : )