not sure how it implemented, but i assume it will move the head or camera according to the Vector3 ?
we can see it defines Vector3.new(x, 0, z) . x usually means left-right. z means back-forth. y means up-down.
there is no up-down here. and i guess we shouldn’t bob back-forth
No, no ignore this, its a module i use for movement, i jsut want to know if its possible to achieve this effect using math - scripting, or is it only done through animations
on the other hand, we shall not just use tick() in the equation, and need to use DT.
check my answer to the other similar post to understand the math behind.
to mimic the uneven up-down bobbing from footstep, try use math.abs(math.cos( ... ))
I am sorry I am not that good at understanding sin and cos waves, could you perhaps edit the original script if thats not a problem, also may you elaborate on “speedvector”, again sorry for the inconvenience
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local tX = 0
local tZ = 0
local speedFactorX = 1 -- you can adjust this for your need
local speedFactorZ = 1 -- you can adjust this for your need
ReplicatedStorage.RenderStepped:Connect(function(dt)
local speed = root.AssemblyLinearVelocity.Magnitude
tX += dt * speed * speedFactorX
tZ += dt * speed * speedFactorZ
...
local bobX = math.cos(tx / (2 * math.pi))
local bobZ = math.abs(math.cos(tz / (2 * math.pi)))
bobSpring:shove( Vector3.new(bobX, 0, bobZ) )
end)