SNIPE! HIGHWAY DEFENDER | DevLog Entry #1
HOLDING A WEAPON
Two Bone IK Constraint | Rig Transform
OBJECTIVE: Using Unity’s Animation Rigging Package, have the character hold a sniper.
The above article goes into the basics of the Rigging package, including the 4 main components needed to set up the Rigging System.
The above video goes into a little more in depth on how I implemented the knowledge laid out below within my project.
To go from this…
To this…
I need to manipulate the arms and hands to target the trigger and the grip of the sniper. The best Constraint Component to handle this task would be the Two Bone IK constraints. By using this constraint I am able to manipulate the Skeletal Structure of the character’s arm (the Shoulder, Elbow, Hand) to naturally target the necessary points on the Sniper.
Below I go into a deeper dive into the type of components I use to complete the objective.
TWO BONE IK CONSTRAINTS
Transforms a simple FK hierarchy of two bones into an Inverse Kinematic expression, controlled by a target and hint GameObjects
→ Useful for animating limbs with realistic IK control, such as arms or legs
Forward Kinematics (FK) Hierarchy
Method of animating where you manipulate the individual transformations of each bone or joint in the hierarchy to create the desired animation pose
Inverse Kinematic Expression
Method of animating where you specify the desired end-effector position (like a hand) and the system calculates the necessary joint rotations to reach that position
Properties
There are five important properties associated with this component…
- Root — [Bone Transformation | Shoulder] — Root GameObject of the limb hierarchy
- Mid — [Bone Transformation | Elbow] — Middle GameObject of the limb hierarchy [MUST BE A CHILD OF ROOT]
- Tip — [Bone Transformation | Hand] — Final GameObject of the limb hierarchy [MUST BE CHILD OF MID]
- Target — [Source GameObject | Trigger/Grip] — specifies the desired position of the Tip
- Hint — [Optional Source GameObject | Influence the way the elbow bends] — position is used to specify the direction the limb should be oriented when it bends
In summary, Two Bone IK Constraints takes in a FK Hierarchy (Root, Mid, Tip) and transforms the transformations into a IK Expression to animate the movement to a target. To control the direction of the bend of the joint, it can also take in a hint.
RIG TRANSFORM
This component needs to be attached to the root of an object that is important for manipulation but are not directly influenced by rig constraints.
Adding the Rig Transform component allows you to control and manipulate this GameObject more explicitly. This component is useful for indicating to the system that this particular part of the rig hierarchy is crucial for animators to control. Even when the GameObject is not directly influenced by a rig constraint.