TopDown Engine  v3.6
MoreMountains.TopDownEngine.WeaponIK Class Reference

This class allows for a 3D character to grab its current weapon's handles, and look wherever it's aiming. There's a bit of setup involved. You need to have a CharacterHandleWeapon component on your character, it needs an animator with IKPass active (this is set in the Layers tab of the animator) the animator's avatar MUST be set as humanoid And you need to put that script on the same gameobject as the animator (otherwise it won't work). Finally, you need to set left and right handles (or only one of these) on your weapon(s). More...

Inheritance diagram for MoreMountains.TopDownEngine.WeaponIK:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

virtual void SetHandles (Transform leftHand, Transform rightHand)
 Binds the character hands to the handles targets More...
 

Public Attributes

Transform LeftHandTarget = null
 The transform to use as a target for the left hand. More...
 
Transform RightHandTarget = null
 The transform to use as a target for the right hand. More...
 
bool AttachLeftHand = true
 whether or not to attach the left hand to its target More...
 
bool AttachRightHand = true
 whether or not to attach the right hand to its target More...
 
Vector2 HeadWeights = new Vector2(0f, 1f)
 the minimum and maximum weights to apply to the Head look at weights when using IK More...
 

Protected Member Functions

virtual void Start ()
 
virtual void OnAnimatorIK (int layerIndex)
 During the animator's IK pass, tries to attach the avatar's hands to the weapon More...
 
virtual void AttachHandToHandle (AvatarIKGoal hand, Transform handle)
 Attaches the hands to the handles More...
 
virtual void DetachHandFromHandle (AvatarIKGoal hand)
 Detachs the hand from handle, if the IK is not active, set the position and rotation of the hand and head back to the original position More...
 

Protected Attributes

Animator _animator
 

Detailed Description

This class allows for a 3D character to grab its current weapon's handles, and look wherever it's aiming. There's a bit of setup involved. You need to have a CharacterHandleWeapon component on your character, it needs an animator with IKPass active (this is set in the Layers tab of the animator) the animator's avatar MUST be set as humanoid And you need to put that script on the same gameobject as the animator (otherwise it won't work). Finally, you need to set left and right handles (or only one of these) on your weapon(s).

Member Function Documentation

◆ AttachHandToHandle()

virtual void MoreMountains.TopDownEngine.WeaponIK.AttachHandToHandle ( AvatarIKGoal  hand,
Transform  handle 
)
protectedvirtual

Attaches the hands to the handles

Parameters
hand
handle

◆ DetachHandFromHandle()

virtual void MoreMountains.TopDownEngine.WeaponIK.DetachHandFromHandle ( AvatarIKGoal  hand)
protectedvirtual

Detachs the hand from handle, if the IK is not active, set the position and rotation of the hand and head back to the original position

Parameters
handHand.

◆ OnAnimatorIK()

virtual void MoreMountains.TopDownEngine.WeaponIK.OnAnimatorIK ( int  layerIndex)
protectedvirtual

During the animator's IK pass, tries to attach the avatar's hands to the weapon

◆ SetHandles()

virtual void MoreMountains.TopDownEngine.WeaponIK.SetHandles ( Transform  leftHand,
Transform  rightHand 
)
virtual

Binds the character hands to the handles targets

Parameters
leftHandLeft hand.
rightHandRight hand.

◆ Start()

virtual void MoreMountains.TopDownEngine.WeaponIK.Start ( )
protectedvirtual

Member Data Documentation

◆ _animator

Animator MoreMountains.TopDownEngine.WeaponIK._animator
protected

◆ AttachLeftHand

bool MoreMountains.TopDownEngine.WeaponIK.AttachLeftHand = true

whether or not to attach the left hand to its target

◆ AttachRightHand

bool MoreMountains.TopDownEngine.WeaponIK.AttachRightHand = true

whether or not to attach the right hand to its target

◆ HeadWeights

Vector2 MoreMountains.TopDownEngine.WeaponIK.HeadWeights = new Vector2(0f, 1f)

the minimum and maximum weights to apply to the Head look at weights when using IK

◆ LeftHandTarget

Transform MoreMountains.TopDownEngine.WeaponIK.LeftHandTarget = null

The transform to use as a target for the left hand.

◆ RightHandTarget

Transform MoreMountains.TopDownEngine.WeaponIK.RightHandTarget = null

The transform to use as a target for the right hand.


The documentation for this class was generated from the following file: