How to detect Bézier curve collisions

I am currently making a projectile system where the user can throw out an object, then if the object collided with anything it bounces and flys back to them. The problem I am having is detecting collisions. I am unsure of how to determine wether a Bézier curve runs through an object, and if so at what point. I have heard about using raycasting to do this, however I have also heard it is performance intensive. I normally don’t work with raycasting/projectiles, which has only made me even more lost.

Does anyone know how I can go about this? Thank you in advance!

Raycasts are probably the most efficient way to do it, just cast a ray a bit infront of the curve and detect if anything is there

2 Likes

For this make sure to loop it until the projectile is destroyed.

Are you suggesting to cast the ray off the object that is being thrown? I didn’t even think of that, but that would probably be optimal as it isn’t as performance intensive yet it still allows me to calculate bounces and collisions.

1 Like

Yeah, It would look something like this. Where the black line is your bezier curve and the red is the raycast. So you would approximate the direction of the curve and then check if there is something infront.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.