The Ability Start Location is an extremely useful component which determines where the character should move towards when starting an ability. It allows for both a positional and rotational threshold so the character doesn’t have to land on the precise point in order for the ability to start. The Move Towards ability will do the actual movement of the character to the closest Ability Start Location.

Setup

  1. Select the object that is being interacted with (the button, ladder, door, etc) and add the Ability Start Location component. In the case of the Interact ability the object selected should be the same object that the Animated Interactable component is attached to.
  2. Adjust the Offset and Rotation Offset fields so the gizmo in the editor will be oriented in the position and direction that the character should start the ability in. As an example for the button press interact ability the gizmo should be positioned where the character should stop and start reaching out their hand to press the button.
  3. If the position or rotation is more variable for when the ability starts then the Size and Angle fields should be adjusted. Adjusting the Size will show an orange line indicating the location that is considered to be valid. A lighter green color will fill in the circle indicating the variance allowed for the angle.

Ability Setup

The Ability class has a virtual method which allows the ability to return an array of Ability Start Location objects:

/// <summary>
/// Returns the possible AbilityStartLocations that the character can move towards.
/// </summary>
/// <returns>The possible AbilityStartLocations that the character can move towards.</returns>
AbilityStartLocation[] GetStartLocations()

By returning the possible start locations it indicates to the controller that the ability requires the character to be in a specific location before the ability can start. As an example the Interact ability will return the AbilityStartLocation on the GameObject that can be interacted with:

public override AbilityStartLocation[] GetStartLocations()
{
	return m_Interactable.gameObject.GetCachedComponents<AbilityStartLocation>();
}

Inspected Fields

Offset

The offset relative to the transform that the character should move towards.

Rotation Offset

The rotation offset relative to the transform that the character should rotate towards.

Size

The size of the area that the character can start the ability at. A zero value indicates that the character must land on the exact offset.

Distance

The ability can start when the distance between the start location and character is less then the specified value.

Angle

The ability can start when the angle threshold between the start location and character is less than the specified value.

Require Grounded

Is the character required to be on the ground?

Precision Start

Should the ability wait to start until all transitions are complete?