Enemy Spawning and chasing AI
Hello and welcome to another devlog where i will talk about my learning process of creating a game.
Here i will talk about an Enemy with AI i made and also the ability to spawn in enemies by clicking on the ground.
ok so first of all here's a gif of me spawning these mean red guys who for some reason want to chase me...
The way i implemented this was to shoot a ray from the camera which keeps track of all objects it passes through, then i sort this list by distance to get a list of objects from closest to furthest, i then spawn an enemy on the first element (closest). The reason i keep track of all objects is just in case i want to add code to only spawn on certain objects later on.
Next is the barrel which you can see above. This uses a nav mesh obstacle which carves a part of the navmesh away when it stops for a brief moment.
Below you can see the AI for the enemy... well who knows maybe they just want a hug?
They have a reference to the player which they use to get the point at which the player is standing. The reference to the player also has code in it to hold the players velocity so they add the players velocity on top of his standing position to get his future predicted position and they use that position to chase the player to try cut them off.
That's all for this devlog, I've got another devlog coming soon with some game ideas for my team to potentially use.
Thanks for reading and have a great day :)
UTAS KIT207 Portfolio
Status | In development |
Author | JButas |
More posts
- Simple Game Update!Aug 09, 2021
- Game Ideas!Aug 07, 2021
- Another Scene Preview and Character MovementAug 02, 2021
- Scene Preview & Model with janky... I mean Amazing Animations!Jul 26, 2021
- Amazing Barrel + Bench Blender Models!Jul 19, 2021
Leave a comment
Log in with itch.io to leave a comment.