Bezier Curves with Velocity

I want to create a curving ball that actually has physics (when I lerp it along a Bezier Curve it’ll just teleport through the wall or clip into the wall.) I’ve seen other posts where they try to curve a ball with BodyVelocity, but it’s just inconsistent with which way the character is facing and doesn’t curve as well.


(The problem with Lerping, it just goes through the wall.)

Is there anyway to do this the correct way?

3 Likes

Only suggestion I could give is to use the .Touched event and add a check to the lerp everytime it changes the CFrame:

local stop = false

ball.Touched:Connect(function()
if ball.Anchored then
stop = true
end
end)

--inside the lerp loop
if stop then
stop = true
ball.Anchored = false
break
end

(This is ofcourse assuming the ball is anchored when lerping)

1 Like

You could move it along a bezier but at each step do a little raycast to see if its about to go through a wall and if it is, stop the movement and set the velocity to the current curve velocity.

1 Like

The ball isn’t anchored during the lerping, it has a bodyvelocity to keep it from falling during it though to look better.