Posted July 05, 2018 by bilbaen0
The Character Controller is the interface that allows a Player to control a Character. It consists of three separate components: the Animator, the Physics Controller, and the Character Data, which interact to turn the Player’s peripheral input into feedback in the form of in-game Character movement.
This graph depicts the flow of data between the three main components of the controller.
PhysicsController:
This component contains a custom physics loop which reads the State Variables Physics Flags to determine the Character’s location, rotation, and velocity in WorldSpace.
It was necessary to write this, instead of using Unity’s similar Rigidbody and Collider components, to remove any non-deterministic behavior and tie the Character’s movement directly to Player input. Being able to replicate movements precisely is a key part of the fighting game genre.
Animator:
Unity’s Animator component contains a state machine which can be used for more than just selecting animations. Each state or sub-state machine can contain an Animation and a number of AnimationBehavior scripts. In this Controller these behavior scripts are used to read current Character Data and determine the proper response. The InputManager and AnimatorParameterManager assist in using the Animator and AnimationBehavior scripts for this purpose.
Character Data:
Data Objects which contain all information needed to determine the actions of the Player and the in-game reaction of the Character.