Slope Limit Behaviour
Description
The SlopeLimitBehaviour
component allows us to define the walk-able behavior of an object as a whole, rather than on a per-face basis. When enabled, it permits us to override the CharacterMovement
slopeLimit
property, providing greater flexibility.
This is particularly useful in cases where we want to constrain (or permit) specific objects or zones to a particular behavior, regardless of their slope limit value. For instance, marking other characters as non-walk-able, preventing a player character from landing on them.
To utilize this feature, add the SlopeLimitBehaviour
to the GameObject
with your Collider
. Then, in the CharacterMovement
component, make sure to set the slopeLimitOverride
property to true.
Enums
/// <summary>
/// The slope behaviour for attached collider.
/// </summary>
public enum SlopeBehaviour
{
Default,
/// <summary>
/// Sets the collider as walkable.
/// </summary>
Walkable,
/// <summary>
/// Sets the collider as not walkable.
/// </summary>
NotWalkable,
/// <summary>
/// Let you specify a custom slope limit value for collider.
/// </summary>
Override
}
Properties
/// <summary>
/// The current behaviour.
/// </summary>
public SlopeBehaviour walkableSlopeBehaviour
/// <summary>
/// The slope limit angle in degrees.
/// Only used on SlopeBehaviour.Override.
/// </summary>
public float slopeLimit
/// <summary>
/// The cosine of slope angle (in radians).
/// This is used for faster angle tests (e.g. dotProduct > slopeLimitCos)
/// </summary>
public float slopeLimitCos
Last updated