instead of activating the bobble with x y z velocity, you will only extract the y axis so the bobble will only be active when x and z is changed
edit: ok so i read this back and it made no sense
i meant instead of the velocity having the x, y, and z axis, only make it so the velocity gets the x and z.
local velocity = some vector
local xzVelocity = vector3.new(velocity.x, 0, velocity.z)
i have answered most of the problems that people had and i put some requirements before people start following this tutorial. honestly if someone thinks that this tutorial is too hard then they need to master the requirement first before proceeding. i also provided some open source code in the replies, pretty sure its slightly outdated
this would probably need a whole other guide, but i can’t seem to figure out where to start on adding multiple guns to the system, i’d appreciate some help of any kind with this
So, to do that you can do , i know there more andvanced way to do it but huh
script.Parent.Equipped:Connect(function()
game["Run Service"]:BindToRenderStep("view_Model_render", Enum.RenderPriority.Camera.Value +1, function(dt)
--view model update function here such as Viewmodel.Primary.CFrame = workspace.CurrentCamera.CFrame
end)
script.Parent.Unequipped:Connect(function()
game["Run Service"]:UnbindFromRenderStep("view_Model_render");
workspace.CurrentCamera.Viewmodel:Destroy()
end)
end)
If anyone is having problems with aim not tweening and the aimalpha just snapping from 0 to 1, I had the same problem and switched to a numbervalue instead of int and it worked
Sorry for the inconvenience, however, the swaying is not working for me. It does not throw any errors or warnings. It simply changes the walking animation:
I’m unsure what I could be doing wrong, as I have been comparing my script to yours for quite a while now.
My update func:
function module.update(viewmodel, dt, recoilSpring, bobbleSpring, swayingSpring, currentModel)
viewmodel.CameraBone.CFrame = game.Workspace.CurrentCamera.CFrame
local aimPart = currentModel:FindFirstChild("AimPart")
local bobble = Vector3.new(getBobbing(10), getBobbing(5), getBobbing(5))
local mouseDelta = UIS:GetMouseDelta()
local character = players.LocalPlayer.Character or players.LocalPlayer.CharacterAdded:Wait()
bobbleSpring:shove(bobble / 10 * (character.HumanoidRootPart.Velocity.Magnitude) / 10)
swayingSpring:shove(Vector3.new(-mouseDelta.X / 500, mouseDelta.Y / 200, 0))
local updatedRecoilSpring = recoilSpring:update(dt)
local updatedBobbleSpring = bobbleSpring:update(dt)
local updatedSwaySpring = bobbleSpring:update(dt)
aimPart.CFrame = aimPart.CFrame:Lerp(viewmodel.CameraBone.CFrame, game.ReplicatedStorage.SWATSys.Values.AimAlpha.Value)
viewmodel.CameraBone.CFrame = viewmodel.CameraBone.CFrame:ToWorldSpace(CFrame.new(updatedBobbleSpring.Y, updatedBobbleSpring.X, 0))
viewmodel.CameraBone.CFrame *= CFrame.new(updatedSwaySpring.X, updatedSwaySpring.Y, 0)
viewmodel.CameraBone.CFrame *= CFrame.Angles(math.rad(updatedRecoilSpring.X) * 2, 0, 0)
game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(math.rad(updatedRecoilSpring.X), math.rad(updatedRecoilSpring.Y), math.rad(updatedRecoilSpring.Z))
end
Nothing happens when I swing my camera around. I was walking to show how the sway changes the walking animation, and doesn’t do what its supposed to do.
Edit so I don’t have to reply: God, that was dumb, can’t believe I didn’t see that lmao. Thanks a lot!