Hello,
I will be short this time:
So, I want to show you my solution example "how to prevent objects from overlapping each other".
I want to say a few introductory sentences that each solution to the problem must basically be based on the individual situation.
My solution is not perfect, but it works and solves the overlapping problem.
Briefly about my task:
It is necessary to make an artificial model of behavior for a zombie.
A zombie must have several states: idle, patrol (random), chase.
The following basic behavior libraries are used in the object: Pathfinding, Solid, LineOfSight, Timer, Bullet.
Logic
- If the zombie does not see the player, the zombie will randomly patrol the road.
- If a zombie sees the player, the zombie chases the player.
- If a zombie collides with another zombie (collide or overlapping), or an object that dynamically blocks its path (eg a door), the zombie stops for a while and recalculates its further behavior with a new one.
- *If a zombie was chasing a player and suddenly the player hides, then the zombie moves to the point where it last saw the player.
- If zombie are blocked by another zombie (zombie in deadEnd) then zombie rotating
*Among other things, the behavior model can be done without the Pathfinding library. Depends on your task.
In this case, you need to understand that the zombie's behavior will also change.