Assist Aim

The Assist Aim ability will rotate the camera or character to face the aim target. The target can be specified using the Crosshairs Monitor component or by setting the target through script.

Setup

  1. Select the + button in the ability list under the “Abilities” foldout of the Ultimate Character Locomotion component.
  2. Add the Assist Aim ability. The ability is concurrent so the ability can be positioned anywhere within the ability list.
  3. If the target should be set with a crosshairs ensure the Crosshairs Monitor has been added to your crosshairs. The Assist Aim ability will target any object that uses the Character’s Enemy Layer.
  4. Set the desired values of the fields on the ability. The values that will most likely require modification are the Distance Influence and Angle Influence parameters.
  5. The Assist Aim ability has the option to target humanoid bones through the Target Humanoid Bone field. If the target is not a humanoid the Pivot Offset component can be added to the target GameObject to apply an offset to the look direction.
  6. On the Assist Aim ability set if the character and camera should rotate towards the target and also set if the character should move towards the target when the target is in view.

API

If you’d like to set the Assist Aim target within your own scripts you can do so with the SetTarget method:

using Opsive.UltimateCharacterController.Character;
using UnityEngine;

public class AimTarget : MonoBehaviour
{
    [Tooltip("The target that should be set to the AimAssist component.")]
    public Transform m_Target;

    public void Awake()
    {
        var characterLocomotion = GetComponent<UltimateCharacterLocomotion>();
        var assistAim = characterLocomotion.GetAbility<Abilities.AssistAim>();
        assistAim.Target = m_Target;
    }
}

Inspected Fields

Auto Select Target

Should the ability auto select the target?

Radius

The radius around the player used to search targets.

Angle

The angle offset from the aim direction to find targets, within the radius.

Require Line of Sight

Is the target required to be within sight?

Center Offset

The offset from the characters center.

Distance Influence

Evaluated between time 0 and 1, defines how the distance affects the selected target.

Angle Influence

Evaluated between time 0 and 1, defines how the angle difference affects the selected target.

Stickiness Angle

The stickiness angle keeps the current target even if it goes out the default angle.

Stickiness Score

The stickiness score is applied on the current target when no input direction is being pressed.

Target Humanoid Bone

If the target is a humanoid should a bone from the humanoid be targeted?

Humanoid Bone Target

Specifies which bone to target if targeting a humanoid bone.

Look At Target

Should the camera focus on the target? If false it will look at the point between the target and character.

Target Offset

Specifies an offset to apply to the target.

Rotate Character Towards Target

Should the character rotate towards the target?

Rotate Camera Towards Target

Should the camera rotate towards the target?

Move Character Towards Target

Should the character move towards the target?

Min Distance

The minimum distance between the character and the target when moving towards the target.

Motor Distance Multiplier

Evaluated between time 0 and 1, defines how the movement is affected depending on the distance of from the character to the target (max distance is time 1).

Can Switch Targets

Can the targets be switched?

Switch Target Input Name

The name of the button mapping for switching targets.

Switch Target Magnitude

The minimum magnitude required to switch targets.

Break Force

The magnitude required in order to break the current target lock. Set to -1 to disable.

Horizontal Break Force Input Name

The input name for the horizontal break force axis mapping.

Vertical Break Force Input Name

The input name for the vertical break force axis mapping.

Stop Speed Change

When the Assist Aim ability is activated should it stop the speed change ability?