The projectiles in my game are very fast, so fast in fact, that OnTriggerEnter events, are recognized too late sometimes, and the bullet is technically able to fly through a thin wall.
Perform a ray cast from the position the projectile is now, to where it’ll be in the next frame. If the ray hits anything, then so will the projectile. You can use the distance along this ray where the collision occurs to tell you when the bullet would hit.
I found a more simple approach, which seems to get the job done.
I basically just made the OnTriggerEnter event a coroutine, which works with Fixed Update:
IEnumerator OnTriggerEnter(Collider other)
{
yield return new WaitForFixedUpdate();
if (WALL)
{
DESPAWN
}
}
on top of that, I reduced the Fixed Timestep in the Timemanager to 0.005.
Now no bullet flies through a thin object anymore.
But I might go back to the raycast method, if this approach doesnt work over the long run.