Aiming Behaviour

Introduction


The features offered are as follows:

1) Procedurally modify existing animations (reload/weapon change etc.) with the user-defined aiming direction
2) Procedurally adapt the character's hands to fit the weapon
3) Procedurally modify the aiming stance by being able to control the position of the trigger hand and having the handle hand adapt accordingly. Aim down sights or from the hip using the same input animation to IKinema's full body IK solver.
4) Separate 'Look At' direction and 'Aiming' direction allows the character to watch one user-defined target while aiming at another.


Out-of-the-box, the aiming node contains internal logic to support automatic procedural aim for the following stances:

- Two Hand Wield (Using a weapon that requires both hands to grip)
- Single Hand Wield (Aiming a single-handed weapon with the offhand not aiming)
- Dual Wield (Aiming a single-handed weapon in both hands)

 

Pre-requisites

The aiming node was introduced in IKinema RunTime V1.8.X. 

The aiming behaviour is an extension of the standard IKinema Look-At behaviour using the Foot Placement node. The following assumes that you have a foot placement character set up with a standard IKinema Rig including at-least a head and chest Look At task and two hand tasks. 

 

Accessing the Aiming Behavior Settings:

1) In the details panel of Foot Placement Node:

-In the "Details Panel" of the Foot Placement node, ensure that the "(As Pin)" flag for the "AimTask" struct is ticked to expose the struct on the node itself.

-In the "Details Panel" of the Foot Placement node, select the "Handle" and "Trigger" bone of your character. These refer to the hand bones (that have tasks in the IKinema Rig) which will be subject to IK solving. In the case of "Two Handed Wielding", the 'Trigger Bone' corresponds to the hand which will be located at the trigger of the gun mesh used, and the 'Handle Bone' corresponds to the hand placed at the handle of the gun. 

Image 1: Aiming Stance Settings In Foot Placement Details Panel


2) In the animgraph node:

-With the above in place, right click and refresh the foot placement node. The "Aim Task" pin will be exposed.

-Tick the "Aim With Weapon" bool.

3) Creating the Aiming Task Node:

-Right-click on the background of the animBP and search for "Setup Aiming Task"

-Select the node to drop it in the animBP

-Connect the "Return Value" pin of the "Setup Aiming Task" node to the "Aim Task" pin of the foot placement node as shown in Image 2 below

 


Image 2 – Foot Placement node with "Setup Aiming Task" node. 

Settings Explained:

The pins exposed in the Setup Aiming Task are a mix of global settings and also settings specific to the "Aiming Type" selected by the user.


Aiming Type Dependent Settings:


1) Type: Single Hand Wield

Image 3 – Single Hand Wield. One gun with which to aim. The offhand is still procedurally modified depending on the desired behaviour.

 

Look Free Arm
If Ticked: The 'Handle Hand' bone of your character will be locked to it's position from the input animation.
If Unticked: The 'Handle hand' bone of your character will rotate with your characters look at task which is dependent on the user defined "Look At Direction".


2) Type: Two Handed Wield

Two Handed wielding behavior is intended for a 'rifle-like' gun which requires two hands to grip. With Two Handed Wield selected, the user has full control over the placement of the hands when in the aiming stance to allow multiple weapon types to be held convincingly with only one input animation regardless of the weapon size or shape. 

 

 

Image 4 – Two handed aiming with trigger hand override disabled 


Image 5 – Two handed aiming with trigger hand override enabled and user-defined trigger hand override transform 


Enable Trigger Hand Override
If enabled, the user can provide a static or dynamic component space transform to lock the handle hand to.


Trigger Hand Override
The component space transforms to lock the trigger hand to.


Handle Socket Transform
A transform defined in parent bone space going from a user-defined handle socket on the weapon mesh to the trigger point

Trigger Socket Transform
A transform defined in parent bone space going from a user-defined trigger socket on the weapon mesh to the root of the weapon skeleton

Handle Hand Alpha
A blend value between the handle hand location in the input animation and the user-defined handle hand location from the "Handle Socket Transform".


3) Type: Dual Wield

This aiming type is intended for two weapons (one per hand of the character), both of which should be aiming at the user-defined target location.

 

Image 6 - Dual Wielding behaviour, one gun in each hand aiming at a single target. 

 

Aiming Type Independent Settings:

For each of the aiming types, the user can choose to use both an 'Aiming Direction' and a 'Look At Direction' to control the aiming direction and also the head look at direction separately.

Use Separate Aim Target

If Ticked: The user can specify an 'Aiming Direction' vector in the 'Setup Aiming Task' node. This will control the chest and direction of aiming for the character.
The 'Look At Direction' specified in the Foot Placement node will apply to the characters head (assuming a standard rig), and the 'Aiming Direction' will control where the character aims.
If Unticked: The Aiming Direction and Look At direction of the character will be defined by the "Look At Direction" vector in the Foot Placement node.

Aiming Direction
This is the target location which the character should aim towards. It can be specified in either the component space of the character or in world space. Which space this vector is required to be in depends on the value of the 'In Component Space' bool in the Foot Placement node.