Comment on page
Hello, my name is...
The Characters component allows to define an object as a character. A Character can be moved around using the appropriate Actions. You can also tweak different properties such as if the character can walk, run, its speed and more
Since version 0.2.5 a character can also perform one of multiple Gestures, such as waving its hand, picking an object, drinking a potion, ... And be in one of multiple States, such as crouched, injured and so on.
Since version 0.2.6 a character can also Jump.
The Character's properties is divided into two big sub-groups: The Basic properties, and the Advanced properties.
As its name implies, the Basic character properties are easily understandable and directly affect how the Character moves.
(Character Basic Properties window)
- Is Controllable: An on/off property that allows to set a character can be controlled with Actions.
- Can Run: A toggle property that restricts the speed of the character. If set to true, the maximum speed the character can move is
runSpeed. Otherwise it will use the walk speed, which is half of the run speed.
- Run Speed: The lineal speed the character moves when running.
- Angular Speed: The speed at which the character rotates towards its desired direction expressed in degrees per second. If this property is set to 180, a character will need one second to turn to its opposite direction.
- Gravity: The downwards force amount that the character experiences
- Max Fall Speed: Maximum fall speed. Setting a low value allows the character to glide.
- Can Jump: Allows to give the character the ability to jump. If set as false, even if the Character receive an order from an Action to jump, it won't do it.
- Jump Force: Default jump force used by the Player jump input and the Jump Action
- Jump Times: Amount of times the Character can jump before touching the ground. Also known as double jumping, triple-jumping, etc...
- Time Between Jumps: The minimum offset time between jumps.
The Advanced character properties are meant to be modified by more advanced users who need finer-grain control over the Player and other NPCs.
(Character Advanced Properties window)
- Face Camera Direction: Controls where the Characters has its body oriented based on the direction it's moving. Can either be:
- Move Direction: The Character rotates towards where it is going
- Camera Direction: The Character looks at the same direction as the camera. The Character will strafe when moving sideways. This movement is useful for aiming weapons
- Target: The Character always faces a target, strafing when orbiting around it
- Ground Plane Cursor: The Character looks at the direction in which the cursor is. Useful for top down shooters.
- Can Use Navigation Mesh: If checked, the character will automatically use the Unity's Navigation Mesh system when moving from one point to another and change back to using the Character Controller if not moving or there's no Navigation Mesh. It is recommended to use this, as it allows to avoid obstacles when moving characters around the scene.
- Save: Tells Game Creator to keep track of the character's position and rotation. When loading a saved game, it will restore the Character's position and rotation to its saved location.
In order to make the system more flexible, the Character and its animation system have been split in two different components.
(You can customize the Animator parameters if you already have a Character system)
The Character Animator has four different sections:
- Animator Parameters
- Character Model
- Inverse Kinematics
These string values behave as a proxy between the Character component and the Animator, gathering locomotion information from the logic controller and plugging it into the Animator. The string values defined inside the Animator Parameters allow to have a custom Animator Controller.
We don't recommend tweaking these parameters unless you are certain of what you want to do. In case you want to use your own Animation solution, you can access the current Character state by calling a public method named
GetCharacterState(). It returns a
Character.Stateclass with information about if the character is grounded or not, its direction, etc.
You'll probably want to make a game with your custom character models. Luckily, changing between characters in Game Creator is as easy as clicking the Change Model button and dragging in the 3D model you want to use from your Project Panel. Game Creator will take it from here and automagically update the character with the new one.
(Automagically retarget any Humanoid bone structure with our Locomotion system)
It is important to note that to correctly retarget the bones of the character, it has to be made a Humanoid. To do so, check the Rig tab on the character model.
You can also change characters in Play-Mode in case you want to see how they look like. Switching back to Edit-Mode will undo any changes made.
Since version 0.4.1 Game Creator allows the use of Inverse Kinematics (aka IK). This advanced technique allows to correctly place the feet of a character taking into account the steepness of the terrain, instead of relying on the animation of the character.
Game Creator goes one step further and has a custom feature called Weight Compensation, which allows the character to slightly elevate or crouch depending on the inclination of the floor, so not only the feet are properly aligned, but also the knees gracefully bend.
Enabling IK comes at a (minimal) performance cost of several Raycasts per frame.
Foot IK allows any Character or Player to correctly align and place their feed even on steep floors.
The default Game Creator animations have the IK settings pre-configured. However, if you're using your own animations, you'll need to set some settings before. See IK in custom Animations for more information.
(With just one click your Characters will realistically align their feet and body to the floor)
Allows the Character to correctly place the hands on certain targets. For example, if the player is driving a car, it can keep the hands on the wheel in spite of the rotation or if the character is holding a weapon, it can correctly place its hands.
(Hand IK set to reach out for the Red Cube)
Allows the Character to slightly rotate its head towards a target. This adds a new layer of realism when moving the character around the world or interacting with other Characters.
(Head IK smoothly following a Red Cube)
Hotspots take advantage of the Head IK and allow to make the character automatically look at the point of interest when the Character is near
By default, Unity imports its animations as Generic. To change the animation type, select the imported clip and click on the Rig tab. There you can select Humanoid under Animation Type.
(Animation Type set as Humanoid)