Configuration - Characters
Configuration Wizard
This asset comes with a configuration wizard that attempts to:
- Make player and Non-Player Character (NPC) setup automatic
- Automatically check and validate all dependency packages and integrations are installed in the project
- Assist with correcting any MMLC-related configuration issues in the project
To access the wizard, go to Tools->Threepeat->MMC Configuration Wizard
The wizard window should appear, as shown below (In image, the window has been docked with the Inspector):
The wizard has three main tabs: "Dependency Checks", "Setup Character", and "Help and Utilities"
Always start with Dependency Checks.
Dependency Checks
Help and Utilities
This tab contains a button to take you to the latest version of this help, which is located here.
Additionally, this tab contains helper utilities. The only currently-exposed utility is "Add Footstep Events to Movement Animset Pro", which will insert all necessary NGFootstepEvent and NGRawAudioEvent Animation Events to make the necessary events in the NGDispatchAnimationEvents component fire. This will allow you to add audio, visual effects, foot prints, and any other kind of reactions needed in response to foot steps. See Audio Events for more information
Setting up an input-driven character (Player)
The new InputSystem is highly recommended, but legacy InputManager is also supported by MMLC and the configuration wizard.
Joystick Support (InputManager)
- The joystick left trigger is used for sprint, and should be named JoystickLeftTrigger and configured in Project Settings -> Input Manager as shown in the below picture:
- In the PlayerCharacter's root object (the object with NGPlayerController component), set use Joystick Axes to true.
Setting up a Non-Player character (AI/NPC)
In addition to standard NavMeshAgent::SetDestination usage, NGNonPlayerCharacter offers a more persistent target transform that allows MMLC to manage reaction to target changes. This can be set/cleared as shown in Assets/Plugins/Threepeat/MMCLocomotion/Scripts/Examples/Example_SetNavMeshTargetOnLKey.
To change/clear a target for any NavMesh-driven character (code assumes it's running in a MonoBehaviour on the same GameObject as the NGCharacter component):
character = GetComponent<NGCharacter>();
NGInputScheme_NavMesh inputScheme = (NGInputScheme_NavMesh)character.InputScheme;
inputScheme.currentTarget = yourNewTargetTransform; // or null if you wish to clear the target.
Tuning Character Behavior for Players and NPC's
Player Only - Controls/Input
The NGCharacter component (and inspector) has an Input Scheme property that points to a Scriptable Object (see "Input Scheme" in image below) that controls all aspects of what drives a character to perform input-related actions. There are schemes for InputSystem, InputManager, and NavMesh (NPC driven by a target on the navmesh).
The inspectors for each of the three InputScheme types are below:
Important
Unlike the config property, a fresh input scheme object is instantiated (cloned) for each character, as otherwise, e.g. all common NavMesh-controlled agents would only be able to move to the same destination.
In the Jumping* section of the InputSystem and InputManager inspectors, shown above, how long the jump key must be held down before a big jump is executed can be configured (set to 0 or a very small number of seconds (e.g. 0.001) for instant big jump), as well as whether to perform an instant big jump when the jump key is pressed while sprinting. In all other cases, the jump will occur on key up or after the max key hold time before jump has elapsed since the key was pressed.
Common - Run/Sprint/Crouch-walk speed, Jump enable/disable, Falling configuration
The NGCharacter component (and inspector) has a config property (see "Config" in image below) that points to a Scriptable Object that controls the character's locomotion and jumping behavior.
Here is the inspector for that Scriptable Object:
These can be found in Assets/Plugins/Threepeat/MMCLocomotion/Configs and created via right-click menu as shown below:
To adjust walk and run speeds of a character, change Walk and Run Speed in the Speeds and Biases section of the NGCharacter config scriptable object. For sprint, adjust Sprint Speed, and crouch-walk speed can be adjusted via Crouch Speed.
While jumping is predominantly configured via the reference NGJumpSettings ScriptableObject (discussed in next section), the Jumping section of the controller contains the toggle for whether a character is able to jump at all.
For falling detection, Fall Detection Time Delay configured the time after the character is no longer grounded (there is no longer any ground surface directly under their feet) before the character goes into a "Falling" state (with accompanying fall- and forward- speed-based animations). Min Height To Start Falling defines the minimum distance between the character's feet and the ground for falling to be engaged.
Note
Since v0.2.0 on, All common settings (applicable to both Player and NPC characters) have been rolled into a top-level NGCharacterConfigBase ScriptableObject to make character classes/types more portable, easier to define, and easier to drop into characters at scale. This also allows wholesale changing of behavior for all commonly-configured characters with a single object modification.
The inspector screenshot above also highlights the two major events available in the core character class:
-
On Jump (boolean: true if big jump, false otherwise)
-
On Land (int: int value of NGCharacterBase.LandingType enum which defines the types of landing available in the controller)
Common - Deeper Jumping Configuration
The below NGJumpSettings ScriptableObject allows different jump behavior to be configured. The items can be configured:
- Jump Force: upward force to apply for regular jumps
- Jump Force Big: upward force to apply for big jumps
- Landing_Distance to Check for Clear Path Ahead: Distance ahead of character at landing to check for obstructions. If no obstructions found, the player will perform a landing roll. Otherwise, the player will perform a stationary heavy landing.
- Landing_Heavy Speed Threshold: Minimum downward speed (ground impact speed) to trigger a "Heavy" landing.
- min Forward Speed For Landing Event: For normal landings below the heavy speed threshold, this defines the minimum forward speed to engage moving landing animations.
Setting up your Character and Environment for Final IK grounder
Environment
-
Create Layers: GrounderOnly and GrounderIgnore
-
Add GrounderIgnore layer to Ground Layers in NGCharacterControllerWrapper in your Top-level player object (e.g. hoodieguy_model)
-
Put all stepped-incline objects (stairs) on Grounder Only layer
-
Put put the smooth inclines that should actually drive non-jittery locomotion on Grounder Ignore layer
-
In Project Settings -> Physics, disable all physics collisions between other layers and Grounder Only:
Character
Important
This section is provided for general reference. If you're using our Motion-Matching Locomotion Controller, the config wizard will automatically configure The Biped IK and Grounder components for you. However, if you wish to perform this step manually, or if you don't any Threepeat assets and just want to set up grounder, here you go:
-
To the sub-object of your character that contains the Animator (and MxMAnimator, etc), Add FBBIK Component:
-
To that same object, add Grounder Full Body Biped component and set settings per the picture below:
-
Make sure All ground layers (except Grounder Ignore) are set in Solver -> Layers
-
Add the Left/Right Shoulders and Left/Right Hands to the Spine list (this causes the player to lean forward when running up inclines and stay more upright when descending inclines to add realism)
-
-
You're done!
Using any of the demo scenes that include Final IK
A version of the Core Demo with Final IK grounder integration is in the Demos directory. This may not work directly after import (due to required Layers not being set up in the project), to resolve this:
-
Create Layers: GrounderOnly and GrounderIgnore
-
Put all stepped-incline objects (stairs) on Grounder Only layer
-
Put put the smooth inclines that should actually drive non-jittery locomotion on Grounder Ignore layer
-
In Project Settings -> Physics, disable all physics collisions between other layers and Grounder Only:
-
Add GrounderIgnore layer to Ground Layers in NGCharacterControllerWrapper in your Top-level player object (e.g. hoodieguy_model)