Atavism IK Handling

Overview:

The AtavismMobIKSystem class is used to control the inverse kinematics (IK) of a game character model’s limbs. It uses Unity’s AvatarIKGoal class to manipulate the position and rotation of the character’s left and right hands and feet. The class can be used to toggle, enable, or disable the IK state of the character’s limbs.

Interface pages:

  1. AtavismWeaponIKTarget: Interface that defines the different types of weapon IK targets that can be used.

Constructor pages:

None.

Method page

void Update()

The Update method is called every frame, if the MonoBehaviour is enabled. It is used to check if the mobAnimator variable is not null and if the left-hand, right-hand, left-foot, and right-foot targets names are not null. If they are not null, the corresponding transform components are obtained using the FindDeepChild method.

void Awake()

The Awake method is called when the script instance is being loaded. It is used to initialize the variables and check if the mobAnimator variable is not null and if the left-hand, right-hand, left-foot, and right-foot targets names are not null. If they are not null, the corresponding transform components are obtained using the FindDeepChild method.

public void ToggleAtavismMobIKState(AtavismWeaponIKTarget.AtavismWeaponIKTargetType atavismWeaponIKTargetType)

The ToggleAtavismMobIKState method is used to toggle the inverse kinematics state of the specified AtavismWeaponIKTargetType. If the state is true, it is set to false, and vice versa.

public void EnabletavismMobIKState(AtavismWeaponIKTarget.AtavismWeaponIKTargetType atavismWeaponIKTargetType)

The EnabletavismMobIKState method is used to enable the inverse kinematics state of the specified AtavismWeaponIKTargetType.

public void DisableAtavismMobIKState(AtavismWeaponIKTarget.AtavismWeaponIKTargetType atavismWeaponIKTargetType)

The DisableAtavismMobIKState method is used to disable the inverse kinematics state of the specified AtavismWeaponIKTargetType.

public Transform FindDeepChild(string aName)

The FindDeepChild method is used to find a child transform with the specified name in the hierarchy of the current transform.

private void OnAnimatorIK(int layerIndex)

The OnAnimatorIK method is called by the Animator component during the IK pass. It is used to set the position and rotation of the left-hand, right-hand, left-foot, and right-foot using the AtavismWeaponIKTarget and AtavismMobIKSystem components.

Interface pages

None.

Constructor pages

None.

 

Properties

Property Type Description
mobAnimator Animator The Animator component of the GameObject.
mobLeftHand bool Indicates whether the left hand of the mob is active or not.
mobRightHand bool Indicates whether the right hand of the mob is active or not.
mobLeftFoot bool Indicates whether the left foot of the mob is active or not.
mobRightFoot bool Indicates whether the right foot of the mob is active or not.
rightHandTargetName string The name of the target for the right hand.
leftHandTargetName string The name of the target for the left hand.
rightFootTargetName string The name of the target for the right foot.
leftFootTargetName string The name of the target for the left foot.
atavismMobLeftHand Transform The transform of the left hand of the mob.
atavismMobRightHand Transform The transform of the right hand of the mob.
atavismMobLeftFoot Transform The transform of the left foot of the mob.
atavismMobRightFoot Transform The transform of the right foot of the mob.
atavismMobLookAt Transform The transform that the mob is looking at.
mobIdleState bool Indicates whether the mob is in idle state or not.
atavismMobIdleLeftHandTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the left hand idle state.
atavismMobIdleRightHandTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the right hand idle state.
atavismMobLeftHandTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the left hand.
atavismMobRightHandTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the right hand.
atavismMobLeftFootTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the left foot.
atavismMobRightFootTarget AtavismWeaponIKTarget The AtavismWeaponIKTarget component for the right foot.
atavismMobLeftHandPositionWeight float The position weight of the left hand.
atavismMobLeftHandRotationWeight float The rotation weight of the left hand.
atavismMobLeftFootPositionWeight float The position weight of the left foot.
atavismMobLeftFootRotationWeight float The rotation weight of the left foot.
atavismMobRightHandPositionWeight float The position weight of the right hand.
atavismMobRightHandRotationWeight float The rotation weight of the right hand.
atavismMobRightFootPositionWeight float The rotation weight of the right foot.
atavismMobRightFootRotationWeight float The rotation weight of the right foot.