Probuilder And Linecast bullets.

Hello im needing some help on figguring out a solution for the problems that i am currently having. Im using pro builder to efficiently build detailed low polly buildings for my game. However im welding together planes to form shapes. However as a concequence i need to use mesh colliders. But the mesh coliders in unity are just crap. Varing of angle of fire to the surface, the bullets go through 20% - 70 % of shots.

I dont want to go around manualy adding in mesh coliders as this is just ineficient and boring. If i build using primitives i end up with a mess of an hirearchy and ~ 1000 + brushes.

Any ideas folks?

ProBuilder-guy here :slight_smile: I would recommend you look into “continuous” and “continuous dynamic” collision methods. Small, fast moving objects are tricky to catch with collision. Also, use Convex where possible.

A third, and perhaps best option, is to use Raycasts instead of collision to determine hits. This is often the best method if your gun is an “instant hit” like a sniper rifle, and generally fine for pistols/rifles/etc, as well.

I hate hitscan weapons they just are so lame XD, besides my game is an open world game, so the balistics will kind of be a big part of the game. I have boosted the efficiency of the hit detection by puting non essential code into a lateupdate function.

The bullet also does not have a rigid body attached, and neither does the walls. It is just a Physics.Linecast() detecting collisions of colliders.

Thanks for your info, i am thinking of experimenting with a prediction system, such as having a raycast project out of the normal direction of the bullet that handles the hits.