Fixing Enemy AI Aiming - Kelsey 11/29/2023
The enemy AI was currently set up with an arrow projectile that had a set aim rotation that was used to determine the location of where the enemy projectiles would shoot when the enemy attacks. With this functionality the enemy AI would shoot the base perfectly but not the player. It was realized after setting up our flying map. This map has the mechanics of allowing the player to equip a jet pack and flying around the map. When the player is flying around the enemy AI they wouldn't aim correctly at the player. With this bug found we realized that the enemy AI never truly aimed at the player unless they were right in front of the enemy AI. Below I have the original mechanics of how the spawn actor uses the arrow projectile for all attack calls.
In order to fix this I needed to make the arrow projectile aim correctly when attack the player. The functionality (shown below) was to get the player's and the enemy's location and find the look at rotation. After interpolating this worked correctly when the enemy was attacking the player, but with this new functionality it would miss the base when not shooting the enemy and instead stayed in the rotation of the enemy. To fix this I used the same Boolean that is used when calling the attack on the player. In the sphere collider we have for attacking the player there is a Boolean called CanAttackPlayer. This Boolean was used in the attack function that way if it is false the arrow projectile rotation doesn't change and goes back to its original values, but if it is true then the arrow projectile on the enemy AI will aim correctly.
Get MystiMayhem
MystiMayhem
Mysti Mayhem is an action RPG where the player uses magic abilities to defeat monsters in different parts of her realm.
Status | In development |
Author | lotuslions |
Genre | Role Playing, Action |
Tags | 3D, Unreal Engine |
More posts
- Enhanced Input for Inventory -Kelsey 12/13/2023Dec 14, 2023
- Enemy Projectile Overlapping - Kelsey 12/06/2023Dec 07, 2023
- Player Model Animation Blueprint - Kelsey 11/15/2023Nov 15, 2023
- Enemy Projectiles - Kelsey 11/8/23Nov 09, 2023
- Enemy Death Animations -Kelsey 11/1/23Nov 01, 2023
- Enemy Defense Mechancis - Kelsey 10/13/2023Oct 14, 2023
- GPU Driver Crash - Kelsey 09/29/2023Sep 30, 2023
- Enemy AI Mechanics – Kelsey 09/20/2023Sep 21, 2023
- Unreal C++ Errors – Kelsey 09/15/2023Sep 15, 2023
Leave a comment
Log in with itch.io to leave a comment.