State Behaviour Editor
- Basic Setup
- Create New State Behaviour Asset
- Create New Character Edit Scene
- Create Bounds, HitBoxes And HurtBoxes
As animation and gameplay are tightly intertwined in fighting games, It is crucial for a fighting game to have tick precise control over an animation’s state; this includes the state of animation motion, the behaviour and last -but definitely not least- the position of the associated hit and hurt boxes.
It is possible to harness the deterministic nature of Quantum for animations by using the Custom Animator and extending it. The Custom Animator bakes the animation motion into the
CustomAnimatorGraphAsset by default. The
Quantum Animation State Behaviours with
HurtBox setup on the other hand is unique to the fighting template.
The initial setup of the Unity Animator in the Fighting Sample is identical to the setup steps explained in the Customer Animator documentation.
N.B.: Read carefully through the
Known Issues section of the
Addons > Custom Animator page as this may impact the design and implementation of the finite state machine.
Create New State Behaviour Asset
QTASB Container script is used to facilitate the editing, organization and visualization of the
QuantumAnimatorStateBehaviour assets associated with an animation state in the Unity Animator Controller.
To set-up a new animation state in Unity for use with the QTASB:
- Add a
QTASB Containerbehaviour script to your animation state.
- In the
QTASB Container, link the
State Asset Directoryfield with the folder holding all of a character’s states. This will create a
FighterAnimatorStateAssetwith the same name as the state and reference it in the
- In the
Behaviourssection at the bottom of the new section, drag and drop concrete
FighterBehaviourAssetimplementation to the
Add Behaviourfield. These assets will be added to the
FighterAnimatorStateAssetreferenced in the State Asset field. Alternatively, click the
+symbol to add or create a new
FighterBehaviourAssetscan be reordered in the list of behaviours.
Once the set up is completed, the
FighterAnimatorStateAsset associated with this animation state can all be edited in this window.
Creating a new special move is as simple as setting up a new animation state, its behaviours and baking the animator.
Create New Character Edit Scene
Each character has their own edit scene (e.g. the Orc character can be edited in the OrcEditScene).
To create a new character editing scene follow these steps:
- Create a new GameObject and add the Character Editor Behaviour to it.
- Reference the Animator and CustomAnimatorGraphAsset of the character to be edited.
- (Optional) Add the CharacterBase for visual reference.
- (Optional) Ensure the Transform component for both the State Editor and CharacterBase GameObjects are in the same position.
N.B.: To scrub an animation, make sure the CustomAnimatorGraphAsset has been imported. When opening an existing scene, it might be necessary to re-link the CustomAnimatorGraphAsset to trigger a refresh before being able to edit it.
Create Bounds, HitBoxes And HurtBoxes
After setting up the edit scene, it is possible to edit, modify and create the
HurtBoxes for the character.
- HurtBoxes (Blue): trigger reaction to collisions with HitBoxes.
- HitBoxes (Red): determine collision area for hits.
- Main Bounds (Green): control how characters collide against one another.
N.B.: Before starting to edit, press the “Import Animator” button.
Instead of defining collision data for every single frame of the animation,
HurtBox Sets are defined. A
HurtBox Set is a set of boxes that begin on a particular frame. To adjust existing
HurtBoxes at a certain frame -e.g. frame 10-, press
Add Hurt Box Set while on frame 10. This will copy the hurt box data from the previous set and then allow adding new or deleting existing
HurtBoxes to the set.
HitBox data, the state being edited needs a
QTABAttackStateAsset referenced in its behaviour list.
HurtBoxes, the main bounds collider can be copied between frames as it only changes punctually when the pose of the character model changes.