Creating an Enemy Cage!

So this lecture used a reverse box collider on the enemy to work out whether it has reached the end of its path. This limits enemies to being in ditches, which I didn’t want. So I created a new empty object and added a box collider. I created a new Layer called “Enemy Constrainer” which didn’t interact at all with any of the components OTHER than the enemy. Then I did an OnCollisionEnter with the tag “Cage” and hey presto! Constrained enemies regardless of wall position.

1 Like

Obviously your comment is very old, but I just wanted to say I really love this.

I’m going through this course, and instantly with this lecture I know it’s restricting the level design I have because of some unique terrain I want to build. Checked the comments and found this, which genuinely feels like a great idea. Thanks!

I’ll do the way from the video first, and circle back later to do this instead when I build more levels.

Privacy & Terms