Enemy Collision

     When testing out multiple enemies at the same time I discovered their colliders would overlap and they would get stuck inside of each other when moving. Clearly this was a big problem because the enemies could not properly navigate and oppose the player. This would be a massive issue for an end user as seeing enemies overlap each other and getting stuck on each other would completely shatter the immersive Ness as because that's not supposed to happen.

    The way I went about fixing this was by implementing separation, which is a flocking algorithm I learned about in our AI class, between the enemies. Essentially separation occurs on impact with any other enemy entity and the way it works is by creating a sphere around each entity its checking with, determining if the distance between the entities is less than the safe distance which is determined by both adding the sphere's radius, and handling collision if any by applied a scaled vector to their position determined by distance. This will allow for the enemy to move around each other and to the player they will just see the enemies avoiding each other and staying spread out.

Comments

Popular posts from this blog

Adding assets to every enemy -- Owen Meyers

Sphere to AABB collision