Shooting and mesh collision

Hello,

For a static mesh that is not breakable, if we setup collision like this for it to stop the player from running through it, would those empty areas stop our bullets or they will pass through?

http://uupload.ir/files/3lyy_untitled.jpg

A trace may be against simple collision or complex collision (mesh)

A complex trace would only be blocked by the geometry.

Can you please clarify a bit?
For example we have a mesh like below image.
We want the bullets to hit the mesh but we also want the bullets to pass through the empty areas. How should the collision for that be setup? (Given we have lots of such meshes in game so performance matters).

http://uupload.ir/files/w1uh_412.jpg

Sorry for the delay in responding - When you execute a LineTrace against the scene, you can choose to trace against the simple collision bodies or the complex collision bodies.

A static mesh supports configuring both complex and simple bodies.

Simple exists because it is faster to query against than complex.
Complex exists because it is more accurate than simple. (complex == use actual trimesh)

To be clear - Physx injects all the collision bodies into a hierarchical spatial acceleration structure (e.g. octree).

This structure is designed to rapidly reject or cull non-relevant bodies.
Due to this , complex collision is still fast - just not as fast as simple collision.

For your case, you can try setting complex collision on the static mesh of the gate and then use LineTraces with complex collision for the bullets.

Profile and see if it is fast enough for you game.

That was very helpful, thank you! :slight_smile: