Objective: Create a character controller, and a character controller driver.
In the previous tutorial, we created movement for our player. You can now freely move around your scene. However, you player will walk through any and all objects. We need to create some collisions. In your traditional 3D environments, you would add a collider, and a rigidbody.
If we look at the locomotion documentation it plainly states we need a character controller.
With this your player will now have collisions with objects in your scene. However, the height is by default set too tall. If we look in the inspector we will see a height setting but we know that one height does not fit all. The player could be standing or sitting.
If we go back to the documentation a little further down, you will see a character controller driver. We can use this character controller drive to set the height of the character controller on the rig with locomotion events emitted by the continuous move provider. This is a long winded was to say that this automatically sets the height to the real-world height of the player relative to the real-world floor.
To finish the driver we need to add a locomotion provider. Luckily when we created character movement in the previous tutorial with the continuous move provider, that is technically a locomotion provider. So select it and drop it in.
Load your scene and your character now has collision detection! I’ll see you in the next tutorial!