Corgi Engine  v8.8
MoreMountains.CorgiEngine.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.CorgiEngine.WeaponIK:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Member Functions

virtual void SetHandles (Transform leftHand, Transform rightHand)
 Binds the character hands to the handles targets 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)
 
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
 
Transform _leftHandTarget = null
 
Transform _rightHandTarget = null
 

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.CorgiEngine.WeaponIK.AttachHandToHandle ( AvatarIKGoal  hand,
Transform  handle 
)
protectedvirtual

◆ DetachHandFromHandle()

virtual void MoreMountains.CorgiEngine.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.CorgiEngine.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.CorgiEngine.WeaponIK.SetHandles ( Transform  leftHand,
Transform  rightHand 
)
virtual

Binds the character hands to the handles targets

Parameters
leftHandLeft hand.
rightHandRight hand.

◆ Start()

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

Member Data Documentation

◆ _animator

Animator MoreMountains.CorgiEngine.WeaponIK._animator
protected

◆ _leftHandTarget

Transform MoreMountains.CorgiEngine.WeaponIK._leftHandTarget = null
protected

◆ _rightHandTarget

Transform MoreMountains.CorgiEngine.WeaponIK._rightHandTarget = null
protected

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