Stable movement features
Last updated
Last updated
These features from the CharacterActor component (as seen in the previous section) will be applied only if the character is stable.
Internally, when the character is stable, the CharacterActor component will project the input velocity (Linear Velocity) onto the current ground surface (Projected Velocity).
This process will always maintain the initial velocity magnitude, regardless of the slope angle.
This algorithm is responsible for determining obstacles along the way. If the encountered surface is allowed the character will walk onto it (maintaining always the displacement magnitude). if not, the slope will be considered as an invisible wall.
This feature is responsible for putting the character on the ground (if there is one). There are two important values to consider:
Step up distance: Any stable surface below this height will be walkable by the character.
Step down distance: When losing contact with the ground, if the distance between the character and the ground is less or equal to this value, then the character will be automatically grounded (sticking to the ground). If there is no ground at all, then the character will be not grounded.
Normally, when a character is standing on an edge it collision shape will make contact with it. What edge compensation does is to lift up the capsule, simulating a cylinder shape.
This feature only works on edges, for slopes you will get the same results as before (with edge compensation disabled).
If the current ground the character is standing on moves/rotates, then the character will move and/or rotate with it (only yaw rotation allowed).
A valid dynamic ground must be updated during the physics simulation. Here are some valid examples:
Kinematic rigidbody that moves/rotates using MovePosition/MoveRotation.
Kinematic/Dynamic rigidbody that moves/rotates based on an animation clip. The update mode must be AnimatePhysics (Animator component).
Dynamic rigidbody that moves/rotates using linear velocity, angular velocity, forces, torque, etc.
If the character is standing on top of a dynamic rigidbody, it will automatically apply a force downwards at the contact point, proportional to the rigidbody mass.
The character can push other dynamic rigidbodies by colliding with them. It is also possible to ignore some rigidbodies by using a dedicated layermask: