How to a make a part curve away and then toward player like this?

I’m making a boss fight for my game and in it, I’m trying to make curving projectiles that will curves away from the player at the start of its trajectory and then end up at the target point. (Player) Like in this video:Let's Play Aquaria [16] - Mermog Cave - YouTube What would be the best way to go about doing this?

1 Like

I’ve seen this done before in games i have not tried to recreate it, But I would think its doing something like making attachments/parts based on a magnitude then moving the attachments/parts in whatever direction, Then creating sizing parts inbetween them in a for i = _,_ do in order don’t know if this would work just how I think it would work

1 Like

Using bezier curves and the quadratic curve works using 3 linear interpolations.

2 Likes

All the methods I’ve used to do this have been pretty hacky and unreliable. I’m just here to tell you that there’s lots of documentation online and on the devforums if you just search “parabolic projectile”. If you still can’t find anything useful, I can send you a script I’ve used in the past (I don’t recommend it though)

Could you please give an example?

There’s 2 ways to do this one way being more difficult and one way being way easier which is the way I use it.

The way I do it is by using RocketPropulsion and Body velocity. I use BodyVelocity to shoot the projectile away from the target then use rocket propulsion to make it curve back and head towards the target.

The second way is by using a method called “bezier curves” This method is good for some ways as it makes pretty decent but is difficult to usually make. Luckily there are a handful resources like modules that people have made. Just search Bézier curve module and you should find one.

If you need any further info on each method just reply.

1 Like

Yes I did some googling before I made this post it seems like a curved raycast, but its not a curve it strait parts. Is this interrelation right? how sound I make a part follow the path of the curve?

Yeah you can do that with the Bézier curves if that’s what you were talking about

1 Like

ok so I have this:


local function qaudraticBezier(pos0, pos1, pos2, t)
	local posFinal = Vector3.new(0 , center.Position.Y + 3.25, 0)
		
	posFinal.X = math.pow(1 - t, 2) * pos0.X + (1 - t) * 2 * t * pos1.X + t * t * pos2.X
	
	posFinal.Z = math.pow(1 - t, 2) * pos0.Z + (1 - t) * 2 * t * pos1.Z + t * t * pos2.Z
	
	return posFinal
end

What do I need to loop though to make the bullets run smoothly?

Edit: pos0 is the boss, pos1 is the center, pos2 is the player’s torso

Bézier Curves | Roblox Creator Documentation near the bottom they show something with paths but how could I adapt it to what I have?