Enemy Aim AI Unity
An Enemy is a person who is actively or hostile to someone or something.
Enemy aim AI is very useful when you want an enemy to aim towards the player controller.
Proper aiming towards an object takes time in real world scenario, so the enemy will take some amount of time before it locks on the target.
Quaternion stores the rotation of an object and also evaluates the orientation value.
One can directly play with Euler Angles, but there may arise situations of Gimbal Lock.
According to the local coordinate system, if you rotate a model about its X-axis then its Y and Z-axis experience a Gimbal lock and become “locked” together.
It Currently works fine for one enemy, but as soon as there are multiple enemies, the possible solution would be to make the enemies move in a random direction every few frames.
More this blog here: Enemy Aim AI Unity
Enemy Follow Script
We create a script similar to the hero’s movement controls script.
The only additions are the Accelerate and Invoke Repeating functions.
It will create a leaping effect while moving towards the targeted object.
It would look as if the enemy is thinking by itself and trying to catch the targeted object.
This kind of AI is a very useful case of action games, where the enemy follows a player and tries to shoot or attack.
One can change the challenge condition as per the need.
It can also increase the following speed in the script in a condition where it is mandatory that the followers should be able to catch the target object.
More this blog here: Enemy Follow Script
Enemy Obstacle Awareness AI
A Ray cast is used to delete if there is any object having collider within the given range and specified direction.
Ray cast is a static method which returns Boolean value i.e true if there is anything and false if there is nothing.
The front rays are used to detect the obstacles if obstacles are found the cube is rotated in either left or right direction to avoid the obstacle.
When front rays detect the obstacle, it should focus only on the obstacle for that point in time.
The backside rays are used to confirm that obstacle is avoided which front rays previously detected.
More this blog here: Enemy Obstacle Awareness AI
No comments:
Post a Comment