Aeterna Blog #4
Situation: Create more realistic enemies and combine the AI and Core movement branches into main so we can work on a prototype.
Task:
- Add character models to the enemies
- Add weapon models for projectiles and weapon
- Source and import animations for the enemies
- Create orbital movement when close to player
Action: I started by selecting enemy models for the enemies, imported using the synty assets by another team member. For variation, I created a male and female goblin for the main enemies. The male variation will have a sword, and female will have a dagger. This adds variation and means the female goblin will have to get closer to attack.
Next, I sourced animations for the enemies. Using mixamo, I was able to easily download and import into unity. Since the synty assets aren’t compatible with mixamos website, I had to create and use a humanoid avatar model created for each model. This will allow the animations to work but some to need tweaking to stop enemies from apearing to be floating above the ground. I managed to find a hunched walk, throwing, and two different attack animations for both enemies. .
I renamed EnemyPrefabs to EnemySettings. This is so that I can use one scriptable object for each enemy to hold distances threshold for attacks and prefabs for projectiles. I added a distance threshold for orbital range, close and ranged attacks.
To include orbital movement around the player, instead of always moving towards the player as done in previous weeks, the enemy will check if they are in the ready state. If they are not in the ready state, they will check if they are in orbital range. If in orbital range, they will orbit around the player in a radius of 3. This is done by setting a random position around the player as the target destination. If they are not in orbit range or are ready to attack, the enemy will walk directly to the player like before.
To finish the fortnight, to allow the enemy to hit the player, I used animation events to enable and disable the weapon collider at specific points of the attack. I also combined both Reubens code and my AI into the main to allow us to work on enemy spawning logic.
Result: During this period, we made significant progress on the game, adding models and combining all our code together for the first time. I also created better looking AI and used orbital movement as well as setting a stopping distance on the Nav Mesh Agents to stop them from walking into the player.