Change Enemy “Visual Area” Collider

I just realized that within Unity 3D, while developing my Super Space Trooper video game, that mesh colliders, even when set up correctly, don’t always necessarily interact with each other properly.  On top of that, there were collisions that worked perfectly fine while the Game window was not full screen, but didn’t work at all when the “Maximize on Play” feature was turned on.

So I had to use a different approach.  Previously, I had created a very low poly triangle that, when attached to an enemy, would work as their viewing cone.  Basically, where their eyes could see.  If the player collided with the enemy’s view code then the enemy would be aware of the player’s location and begin an attack.  For a while I had been wondering why so few of the enemies were responding as expected, so I decided to figure it out.

Now I have replaced that with a series of sphere colliders.  They start off small at the enemies position and get progressively larger and larger the further they are from the enemy, each joined to the next.  It’s not exactly a triangular viewable area, BUT because it’s sphere colliders instead of mesh colliders, the CPU resources have been cut back significantly.  Apparently the sphere collider is the least CPU intensive of all the colliders in Unity.

With these changes, I suddenly find the game being much more difficult.  That further proves that the previous way I was doing it just wasn’t working as expected.

Posted in Enemies, Super Space Trooper, Unity 3D, Video Game Development

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>