How would I raycast a complex mesh?

I am making an FPS system where the map is made out of meshes and I’m having a problem where the rays end hit hitting the inaccurate PreciseConvexDecomposition collision of a meshpart instead of the mesh itself.

Example of the problem:

Door I want to shoot through:

Hitbox of the door:

Is there a way to do raycasts that would go through this hole in the mesh accurately without needing to create hitboxes manually? I need a way to raycast the visual geometry of a mesh instead of the hitbox.

1 Like

PreciseConvexDecomposition should not be filling doorways like this. This is either a bug, or there is something nasty about your mesh geometry. You should post the MeshId or an rbxl file with the mesh so that the physics team can look into this.

If you need it working right away, you should look at your source mesh and make sure there is nothing wrong with it, like loose or duplicate geometry. If all else fails, you can cut the mesh up pretty easily to solve this.

2 Likes