Slow projectile collision

How would I calculate the collision of a slow moving projectile? Right now I am just using the Touched function but I don’t think it is very consistent. I don’t know what else I could do considering this projectile is server side. I was thinking of firing lots of rays in a loop but that seems inefficient and could lead to server lag if multiple projectiles are fired.

1 Like

Maybe shoot one ray from the tip of the projectile and dont make the ray long make it short and as soon the ray detects something you could use that ?

1 Like

There is a new form of raycasting that is currently in beta, it is called shapecasting.

Another approach would be using a heartbeat function that checks if the projectile is inside another part using workspace:GetPartsInPart(projectile, params).

2 Likes

Does shapecasting allow for curved shapes? Or would I still have to constantly fire a shapecast ray to create the arc of the projectile

Create a workspace:SphereCast at the tip of the projectile and do a loop until it finds something to hit:

A code sample can be found on the API:

Try raycast between the current tip position and last tip position. This method works any projectile speed

Ah ok thanks ill try this out when I’m home!