Component managing player IK is 'IKHelper'.
'IKHelper' manages both hands and both legs IK features.
For usage on player and NPC left hand IK while holding a weapon is more specialized 'LeftHandIK' and 'NPCLeftHandIK' components.
Additionally with IK, 'LeftHandIK' and 'NPCLeftHandIK' also keep hand rotated and aligned with a weapon.
Difference between player's 'LeftHandIK' and NPC's 'NPCLeftHandIK' is that player uses two IKs, one in aiming animation and one in all other animations.
Npc uses only one IK.
Player left hand IK is assigned on per weapon basis. Since the player is constantly switching weapons, a weapon has fields for assigning IK transform and left-hand rotation values.
IK and left - hand rotation values can be adjusted in weapon adjustment window.
Open window by clicking on 'Tools/Combat Framework/Adjust Weapon Window'' and choose 'IK Adjustment' tab ( after player and weapon is dragged to 'Player'
and 'Weapon' fields ).
Choose aim mode by checking 'Aim' checkbox or keep unchecked to create IK used in locomotion and other animations.
Create IK by clicking on 'Create IK' button after which lefthand rotation sliders will show.
Also is shown left - hand 'openness' value which can also be adjusted.
Adjust the IK position by moving the mouse with the middle mouse button pressed.
Adjust left-hand rotations and left hand open/close values with sliders.
After IK is adjusted – click on 'Save'.
Left hand IK weights are set up in animation import settings by adding curves 'pLeftHandIKWeight' and 'pAimIK'.
Curve 'pLeftHandIKWeight' is overall weight of IK:
zero = no IK, 1 = full IK.
Curve 'pAimIK' is weight of aim IK:
0 = no aim IK - full locomotion IK
1 = full aim IK - no locomotion IK.
Like stated previously, the reason why 'IKHelper' is not used for left hand IK is because 'LeftHandIK' script switches between two transforms when managing IK – locomotion IK
target and aim IK target and also keep left hand aligned with a weapon.
'IKHelper' have three modes to set IK targets:
point, line and plane.
- 'point' - what the name says, points IK effector towards a point or position.
Point can be assigned by assigning target position ( Vector3 'LHPosition' ) or by assigning transform ('LHTargetTransform' ).
Transform overrides Vector3 so be sure to set 'LHTargetTransform' to null if using Vector3 'LHPosition'.
Although the system does that automatically by assigning 'LHPosition' property,it is a warning if you using directly private field 'm_LHPosition' ( that applies on all other limbs IK variables ).
- 'line' points effector towards the closest point on a line.
Assign line IK by using points ( Vector3 ) or transform.
Transform calculates line points along the X-axis.
Line transform overrides line points so make sure to set line transform to null before using line points ( it gets nulled automatically by using 'setIKLinePoints(...)' method ).
- 'plane' - points effector towards the closest point on a plane.
Set IK weight by creating curves in animation clip:
'pLeftHandIKWeight', 'pRightHandIKWeight',
'pLeftFootIKWeight' and 'pRightFoorIKWeight'.
Also, additional weight multipliers can be used outside of curve values.