Overview | Videos | Documentation | Demos | Integrations | API | Support

Doc Home > Character > Abilities

The ability system allows the character to add new functionality without touching the RigidbodyCharacterController code at all. The abilities can have complete control over the RigidbodyCharacterController or can work along the side of the RigidbodyCharacterController. For example, the Vault ability completely prevents the controller from updating when it is active. On the other end of the spectrum, the Speed Change (sprint) ability works with the controller and just modifies an Animator parameter when the character should be sprinting.

New abilities can be added by deriving your new class from the Ability class. This new ability will then automatically show up under the abilities drop down within the RigidbodyCharacterController component inspector. Abilities have a priority system in that the higher the ability is on the list, the higher priority it has. For example, lets say that the crouch ability has a higher priority than the jump ability. If this is the case then the jump ability would not be able to play while the crouch ability is active because the crouch ability will override any lower priority abilities.

The following API can be used by the abilities. Methods that return bool indicate if the RigidbodyCharacterController should stop execution of that method with its own functionality.


// Can this ability run at the same time as another ability?
public bool IsConcurrentAblity()

// Executed on every ability to allow the ability to update.
// The ability may need to update if it needs to do something when inactive or show a GUI icon when the ability can be started.
public void UpdateAbility()

// Can the ability be started?
public bool CanStartAbility()

// Can the inputted ability be started?
public bool CanStartAbility(Ability ability)

// Can the ability be stopped?
public bool CanStopAbility();

// The ability has been started.
public void AbilityStarted()

// Returns the destination state for the given layer.
public string GetDestinationState(int layer)

// Returns the duration of the state transition.
public float GetTransitionDuration()

// Can the ability replay animation states?
public bool CanReplayAnimationStates()

// The ability has stopped running.
public void AbilityStopped()

// Moves the character according to the input.
public bool Move(ref float horizontalMovement, ref float forwardMovement, Quaternion lookRotation)

// Perform checks to determine if the character is on the ground.
public bool CheckGround()

// Apply any external forces not caused by root motion, such as an explosion force.
public void CheckForExternalForces(float xPercent, float zPercent)

// Ensures the current movement is valid.
public bool CheckMovement()

// Apply any movement.
public bool UpdateMovement()

// Update the rotation forces.
public bool UpdateRotation()

// Update the Animator.
public bool UpdateAnimator()

// The Animator has changed positions or rotations.OnAnimatorMove method?
public bool AnimatorMove() 

// Does the ability have complete control of the Animator states?
public bool HasAnimatorControl(int layer)

// Can the character have an item equipped while the ability is active?
public bool CanHaveItemEquipped() 

// The character wants to interact with the item. Return false if there is a reason why the character shouldn't be able to.
public bool CanInteractItem()

// The character wants to use the item. Return false if there is a reason why the character shouldn't be able to.
public bool CanUseItem()

// Should the upper body IK be used?
public bool UseUpperBodyIK()
Abilities can be started and stopped by an input button or automatically. For example, the Crouch ability should only be started when the player taps the Crouch button. On the other hand, the Fall ability should be triggered when the character is in the air and has a negative y velocity.

Input Name
The button name that can start or stop the ability

Start Type
Specifies how the ability can be started from input

Stop Type
Specifies how the ability can be stopped from input

Transition Duration
The length of time it takes to transition to the ability

Speed Multiplier
The Animator multiplier of the state

Indicator
The sprite indicator used to specify that the ability can start or is active


<- Controller
Balance ->