How do I make a part go forward and curve?

I’m trying to make a system where if you touch the part than it will go forward with a curve.
Thank you for reading.

DevHub has a good article on Bezier curves that should help you out

1 Like

Although that’s a really good article I do not understand that can you further explain more if you can please?

I honestly doubt you read it in 5 minutes or even clicked on it. It explains what Bezier curves are and even provides the functions for creating the curves. All that’s left to do is implement them in your game. If you want a part to go forward & curve you would lerp it through your Bezier curve function to make it appear smooth. In the Bezier functions t represents the alpha at which your curve is at. So for example if t is 0.5 then it’s halfway.

I did, but how am I supposed to understand:

  1. function drawLine(p1, p2)
  2. local v = (p2 - p1)
  3. local f = Instance.new(“Frame”)
  4. f.Size = UDim2.new(0, v.magnitude + 1, 0, 2)
  5. f.Position = UDim2.new(0,(p1.x + v.x/2) - f.Size.X.Offset * 0.5, 0, (p1.y + v.y/2) - f.Size.Y.Offset * 0.5)
  6. f.Rotation = math.deg(math.atan2(v.y, v.x))
  7. f.BorderSizePixel = 0
  8. f.BackgroundColor3 = Color3.new()
  9. return f
  10. end

What do you need to do this for? Are you making a car?

Sorry for the late response I didn’t see. I’m making a tennis ball.

How do you want it to work, exactly?

What does “curve” mean for you?

Should it go in a particular direction?

Should it move in a circle?

So I want it to go forward than it will start going up than after a while start going down.

So… do you just want to launch a ball in the air and have physics affect it from there?

Yes so whenever you touch it, it will start. That’s my goal for this project.

Okay! In the future when you ask questions on here it helps if you give all the info up front so we don’t have to interrogate you to figure out what you’re actually asking :slight_smile:

Use the BasePart | Roblox Creator Documentation event to detect when the ball is touched.

You can use BasePart | Roblox Creator Documentation on the tennis ball to push it in some direction.

You can calculate the direction to pass to ApplyImpulse by using the CFrame.LookVector property of the touching player’s Character.HumanoidRootPart, add some vertical velocity to it + Vector3.new(0, 1, 0), and multiple the whole thing by like 100.

Try to put something together like that, and then come back :slight_smile:

To start, you can just try printing out the name of the player when they touch the ball.

1 Like

Ok I did as you said but now I’m wondering how do I make it go down and make it less chunky. Also in order to do this I need it to be anchored, but it won’t work without it being un-anchored. Also how do I make it go toward the player’s look vector?