Guards Collision Fix

I have noticed a bug where the guards would collide with each other, regardless of whether their colliders are on or off and they did that even when dead. It didn’t make much sense to me or James, so it actually took me quite a long time to figure out the issue. We started off by making sure all colliders were off, on top of the usual ‘GetComponent<Box Collider>()’ that we already used.

I then played around with Layers in Unity as I thought maybe that could solve the issue. I did that by changing the enemies’ Layer to Enemy, and then went to Edit>Project Settings>Physics where you can find the Layer Collision Matrix which determines which Layers can react with each other. That also didn’t solve the issue, which was odd because when I created a new scene with some cubes, it did work correctly.

That’s when I thought it’s probably an issue with the NavMesh feature, and it turned out I was right. The Obstacle Avoidance feature of the Nav Mesh Agent was causing the issue, and I solved it by changing all the values in that tab to 0 (which weirdly turned some of the values to ‘1e-05’), like so:


Now, the guards no longer collide with each other:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s