
SPIRITAL
Project Type
Project Duration
Engine
Primary Role
: University project
: 3 Months
: Unity 3D
: Tools / AI Nav Programmer
Promotional Video
I felt that there's a need for a level editor to help the designers build the levels, and so I went and did it as my first attempt to editor scripting in the Unity engine. I aimed for it to work like Minecraft's block placement mechanic, and also functions to place multiple blocks at once
Placing multiple blocks with a press of button
Click to place down blocks
Right click to delete blocks
I made an audio manager to hold all audio clips used in the game with an assigned audio source to each clip. I wanted to make this easy to use so I did some editor scripting that allows my team member to regenerate the audio clips by script every time they add a new audio clip to the manager.
Besides that, the audio manager would automatically create new audio sources in an event that multiple instances of the same sound effects needs to be played simultaneously.
For this project, I mainly used the Unity's navmesh component for the pathfinding. The AI would path towards the block the player pressed on, instead of pathing towards the specific coordinates of the input. This was a design decision made so that the player character doesn't feel like it is "moving all over the place".
To eliminate the awkward rotations and steering of the actor, I also made sure that the actor would rotate face the direction it would move towards first before moving. To achieve this, everytime a "move" command was issued to the navigation agent, a script would first find the path from the actor's position to the destination and identify all the corners, storing those points in a container. Then, through a coroutine the actor would rotate towards the next corner, move towards it, and repeat until it reaches the destination.
Lastly, I faced a problem where the actor would sometime "slide" beyond the mid point of the destination block, which is not something we want to see. Therefore, I added a function for the actor to "recorrect" itself by moving back to the midpoint of the block when it is done with the navigation.