/// ---------------------------------------------
/// Ultimate Character Controller
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.UltimateCharacterController.Character
{
using Opsive.UltimateCharacterController.StateSystem;
using System;
using UnityEngine;
///
/// Base class for applying IK on the character. Allows other IK solutions to easily be used instead of Unity's IK system.
///
public abstract class CharacterIKBase : StateBehavior
{
// Specifies the limb affected by IK.
public enum IKGoal
{
LeftHand, // The character's left hand.
LeftElbow, // The character's left elbow.
RightHand, // The character's right hand.
RightElbow, // The character's right elbow.
LeftFoot, // The character's left foot.
LeftKnee, // The character's left knee.
RightFoot, // The character's right foot.
RightKnee, // The character's right knee.
Last // The last entry in the enum - used to detect the number of values.
}
// Other objects can modify the final ik position/rotation before it is sent to the IK implementation.
protected Func m_OnUpdateIKPosition;
protected Func m_OnUpdateIKRotation;
public Func OnUpdateIKPosition { get { return m_OnUpdateIKPosition; } set { m_OnUpdateIKPosition = value; } }
public Func OnUpdateIKRotation { get { return m_OnUpdateIKRotation; } set { m_OnUpdateIKRotation = value; } }
///
/// Updates the IK component after the animator has updated.
///
/// Is the IK being updated within the FixedUpdate loop?
public abstract void Move(bool fixedUpdate);
///
/// Specifies the location of the left or right hand IK target and IK hint target.
///
/// The transform of the item.
/// The hand that the item is parented to.
/// The target of the left or right hand. Can be null.
/// The target of the left or right elbow. Can be null.
public abstract void SetItemIKTargets(Transform itemTransform, Transform itemHand, Transform nonDominantHandTarget, Transform nonDominantHandElbowTarget);
///
/// Specifies the target location of the limb.
///
/// The target location of the limb.
/// The limb affected by the target location.
/// The amount of time it takes to reach the goal.
public abstract void SetAbilityIKTarget(Transform target, IKGoal ikGoal, float duration);
}
}