Hello! I am wondering if there is a way to speed up lerps without skipping positions. My game is a volleyball gameuses hitboxes, but sometimes lerps can skip past the hitbox. An example of this would be with blocking.
Thank you in advance
Hello! I am wondering if there is a way to speed up lerps without skipping positions. My game is a volleyball gameuses hitboxes, but sometimes lerps can skip past the hitbox. An example of this would be with blocking.
Thank you in advance
Whats your current code?
if your using deltaTime from a HB / Other try adding a +0.1 / 0.05 etc…
Otherwise try using Spr(ing) / TweenService?, Hey even bezier curves
this is a snippet from the code:
con = runs.RenderStepped:Connect(function(dt)
stillupd = true
i += dt
if ball.Parent.Parent == nil or ball.Parent:GetAttribute("CanUpdateLerp") == false or ball:GetAttribute("LerpID") ~= lerpid then con:Disconnect() return end
if (ball.Position - c2.p).Magnitude < 3 then con:Disconnect() return end
local rayparams = RaycastParams.new()
rayparams.CollisionGroup = "ServerBall"
rayparams.IgnoreWater = true
local rayres = workspace:Raycast(ball.Position, ball.CFrame.LookVector * 3,rayparams ) or workspace:Raycast(char.HumanoidRootPart.Position, frontraycast, rayparams)
if (rayres and rayres.Instance) then
if rayres.Instance.Name == "Net" then
if not netcon then
c1 = ball.CFrame
netcon = runs.RenderStepped:Connect(function()
if ball.Parent:GetAttribute("CanUpdateLerp")== false then netcon:Disconnect() return end
if (Vector3.new(ball.Position.X, ball.Position.Y, 0) - Vector3.new(c2.X, c2.Y, 0) ).Magnitude < 3 then netcon:Disconnect() return end
ball.CFrame = CFrame.new(c1:Lerp(c2, i *2).X, c1:Lerp(c2, i*2).Y, rayres.Instance.Position.Z - char.HumanoidRootPart.CFrame.LookVector.Z * 2)
end)
end
end
return
end
if not netcon then
ball.CFrame = CFrame.lookAlong(c1:Lerp(c2, i * 5).p, lv)
end
end)
Bezier curves use lerping so I dont think that would solve anything. Also, what is Spring?
I dont think it will be good in your use case actually but here is the forum about it: Spring-driven motion - spr
This makes the ball go slower though