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 this script (WeaponIK) 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...
|
| virtual void | SetHandles (Transform leftHand, Transform rightHand) |
| | Binds the character hands to the handles targets.
|
|
| Transform | LeftHandTarget = null |
| | The transform to use as a target for the left hand.
|
| Transform | RightHandTarget = null |
| | The transform to use as a target for the right hand.
|
| bool | AttachLeftHand = true |
| | whether or not to attach the left hand to its target
|
| bool | AttachRightHand = true |
| | whether or not to attach the right hand to its target
|
| Vector2 | HeadWeights = new Vector2(0f, 1f) |
| | the minimum and maximum weights to apply to the Head look at weights when using IK
|
|
| virtual void | Start () |
| virtual void | OnAnimatorIK (int layerIndex) |
| | During the animator's IK pass, tries to attach the avatar's hands to the weapon.
|
| virtual void | AttachHandToHandle (AvatarIKGoal hand, Transform handle) |
| | Attaches the hands to the handles.
|
| 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.
|
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 this script (WeaponIK) 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).
◆ AttachHandToHandle()
| virtual void MoreMountains.TopDownEngine.WeaponIK.AttachHandToHandle |
( |
AvatarIKGoal | hand, |
|
|
Transform | handle ) |
|
protectedvirtual |
Attaches the hands to the handles.
- Parameters
-
◆ 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
-
◆ 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
-
| leftHand | Left hand. |
| rightHand | Right hand. |
◆ Start()
| virtual void MoreMountains.TopDownEngine.WeaponIK.Start |
( |
| ) |
|
|
protectedvirtual |
◆ _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:
- H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/Weapons/WeaponIK.cs