I have implemented pooling for my projectile, where it adds the projectile to a pool once it collides with the BobbleArena / Alien / Columns (Ch. 4, Page 108).
However, I found that if I stand close to the arena walls, that the method:
OnCollisionEnter does not always trigger. I found out that this is because the mesh collider for the wall isn’t always being hit when the projectile hits the walls.
Thus, sometimes I have to wait until the projectile goes invisible (calling the
OnBecomeInvisible - which could take up to 10 seconds depending on where I hit on the arena).
My questions are:
- What is a reliable approach for making sure that
OnCollisionEnteris called when the projectile doesn’t always hit the mesh collider?
- Is there a way to check how far the projectile has travelled, and then pool the object based on the distance it has travelled?
- Is there a more reliable way to improve the mesh collider so that
OnCollisionEnteris always called, regardless of where you hit in the BobbleArena?
Thank you for reading.