Making a Voice Controlled Character: Part 3 - The finer details


The additional commands for specific actions brought their own challenges to the project.

Looting

As the character is an AI agent that requires player input to control it, moving to a specific spot is not as simple as just walking up to it. Most interactions required specific overrides to behaviour or extra navigation waypoints.

Looting in particular was the first and most obvious issue. When the player tried to loot something, the agent would move to the nearest point on the navmesh to the loot and then grab it, which is fine, until the nearest point on the navmesh is on the other side of a wall, shelf, or other obstacle and suddenly your character is running halfway around the map to grab the loot that was right in front of him!

This resulted in the addition of a raycast from the character to the loot, taking the collision point of the raycast with the first navigation obstacle along the line and then getting the nearest point on the navmesh to that instead of to the loot. This corrected the behaviour where loot set on the back of a shelf would cause the agent to go for a long stroll. Specific spots to grab each loot item from was another solution considered but was discarded since some objects were lootable from both sides of a shelf or might be located on a corner and lootable from more than one side. 

Stairs

In the prototyping stage for the controls, placeholder stairs in the scene were very narrow, and more precise controls were not available for lining up the agent on a staircase, so an override command to navigate a staircase was added. While this command functions fine, some playtesters were attempting to navigate the stairs manually now that it was not unreasonable to line up on a staircase. This however unveiled another issue. The character would get to almost the top of the staircase and then stop. It turns out that as the agent was looking in front of themselves as they moved with a raycast, they were seeing the side wall, shelving, or walkway that the stairs were going to the top of and detecting an obstacle and stopping before they walked into it.

Some layer changing and a ground level collider added to each object being ascended with original collision layering made the agent no-longer see the higher parts of these objects as an obstacle but still avoid walking into the base, letting them complete the manual ascension of staircases.

Leave a comment

Log in with itch.io to leave a comment.