In this mini-project, I pursued two objectives: first, to understand technically how to create a game scene that would run on the Microsoft HoloLens; and second, to add some life-likeness to a game character by introducing a dynamic behaviour.
Essentially, this project shows a scene that contains two game objects: a generic white cube, and a humanoid “Hero” model with a few animations. These objects may be selected and moved by the user.
I coded the “Hero” character to always look at the cube as long as the cube was visible from his current position. If the centre of the cube is moved out of his line-of-sight, his gaze returns to its original position.
In the first image below, the “Hero” character is standing on the floor looking up at the cube. The blue circle is the HoloLens gaze cursor, which is the centre of the user’s gaze.
In the second image, the cube has been moved out of the “Hero” character’s line of sight, so his gaze returns to front-and-centre. The user can see the bottom of the cube in the upper-left corner of this image, but the Hero’s view of the cube is obstructed by the real-world desk.
The character’s gaze can be used to visually indicate to the user/player what the character is paying attention to or thinking about. It may serve as one tool in an interactive-storytelling tool chest.
[This project builds on code from the “Holograms 201” example project available on the Microsoft Developer web site. I adapted the “Head Look Controller” package from the Unity Store (the package included the humanoid “Hero” model and animations).]