Research Coding Projects 3D




This is project I created together with Cédric Bonnarens, Matthias Van Cauteren, San Nollet, Elliot Bocxtaele and Tom Ivens.
The intention of this project was to train the moter skills of revalidating patients after a stroke attack.
We used the kinect to accomplish this, by holding a certain position the player could progress in the game.
The player himself did not have that much input he could give because the game basically works as a state machine.
After the player completed all the exercises he will be given a reward to decorate his garden.
Behind the scenes an e-mail would be send to the docter who is observing the patient to see what progress he made.
The idea behind this game is that revalidation exercises are a bit boring and Gardenia needs to stimulate the patient to continue his exercises.


  • Unity


  • C#
  • GLSL

Download Paper Download Binaries


image carousel

Code Demonstration


When I started coding for our project I learned about messaging inside C++. I applied the same techniques inside unity to create a message handler.
To create a message handler you need 3 things.
  • Listener
  • MessageData
  • MessageManager


This is a data class that will be used by the messagemanager to hold data about the messages that need to be send. The object will have the following variables
  • ListenFor - Is the name of the message that will be called.
  • ForwardObject - The object the message will be send to.
  • ForwardMethod - The name of the method which the message will be translated to.


This is a data class that is intended to be inherited from. If a message needs to be send the programmer needs to create a custom messagedata class inherted from this class.

public class MessageData
    public MessageData(string name)
        Name = name;

    public string Name;

//An inherited version of the class will look like this
public class PlayerData : MessageData
    public PlayerData(string name, Vector3 location)
        Location = location;

    Vector3 Location;

Message Manager

The messagemanager will hold a list of Listeners objects. This class will contain two methods
  • RegisterListeners
  • SendToListeners
RegisterListeners will have a parameter of a listener object he will add this object to the listener list if it does not contain it already. SendToListeners will send a message to all objects with the given message name.

Robot Behaviour

The robot works like a state machine. For every behavior the robot can do a state needs to be created. Each of these states is separate classes that inherit from a base class called “RobotState “(see next topic). The robot will execute the behavior of each state during his update. The state can only be changed by sending a message to the robot with the new state. Automatically the robots behavior will update when the robot script reaches the update method again by using the newly assigned “RobotState”. The robot will have some public variables that will help him execute his behavior.
  • - PlayerTargetLocation - the position for the robot at the players location
  • - FirstPersonTargetLocation - the position for the robot for first person look
  • - StoreTargetLocation - the position for the robot at the store location
  • - CurrentState - the current active state of the robot
  • - Speed - movement speed of the robot
  • - RotationSpeed - rotation speed of the robot
  • - NavigationAgent - make path finding possible by adding a navigationmeshagent component to the robot assign it to a property, this will let every different state of the robot be able to access it.

Robot State

The robot will have different states that represent certain behavior. Each state will be accessed by the robot himself and can be changed by sending a message to the robot with a new message. All state inherit from 1 class that’s called “RobotState”.

public abstract class RobotState 
    public RobotBehaviour RobotBehaviour
        get { return _robotbehaviour; }
        set { _robotbehaviour = value; }

    private RobotBehaviour _robotbehaviour;

    public abstract bool ExecuteBehaviour();

    protected abstract bool UpdateState();

As you can see every class inherited from this class will have access to the robot behavior script to check on certain event and current state of the robot. Execute behavior will be called every frame to execute the behavior of the current state also Update state will be called to check if we need to switch states.