Are you able to Bend Raycasts

Hello!, I was wondering whether you could “bend” raycasts. I’m trying to make a projectile system and I’m stuck on how to achieve this effect. Any help would be taken into account and would be appreciated.

i think you want to make a proyectile motion, i recommend u to read about bezier curves

1 Like

No raycasts cannot be bent. If you want a curve you will have to create multiple raycasts and rotate each new ray so it matches the curve you want.

1 Like

You can’t really bend a raycast (unless you shot a buncha rays all connected that would create a curve, which is pretty inefficient)

I think if you are going for a projectile moving in a curved motion, you should define a path and have a part move in the set path. If that part interacts (or touches) with something, you would make it do what you want. You would want a curve for an object moving slowly as gravity acts upon it.

This article provides an insight into Bézier Curves (which can be used to create the path that the projectile moves in).

As I said, you would have to shoot a bunch of rotated raycasts that connect to have a “curved raycast”. But I would only be doing that if I wanted the damage to be instantaneous (which wouldn’t realistically make sense unless it were to be a speeding bullet).

You could use fastcast for simulating raycasts if physics were to act upon them.(Like gravity)

It is not efficient to raycast a bunch of times? The shorter the ray the more performant, although there is virtually no difference. Having a part do the hit box is miles less performant than raycasts. It can also cause a bunch of other problems. Not to mention it’s much harder to do.

Rays don’t have to be instantaneous either.

1 Like

What I think I could do is have a bullet and calculate its trajectory for 6 or 7 frames, then at the end fire a raycast from the starting frame to the ending frame for hitscans.