Skip to content

3. Weapons Alignment (Rifle)

This page continues from the character-retargeting setup. At this point, the custom character can already follow ALS locomotion, but the rifle overlay still needs character-specific alignment.

The goal is to fix two separate problems:

  1. the rifle must attach to the visible character’s right hand
  2. the left hand must reach a valid grip point on the rifle

The final setup uses:

  • a Rifle socket on the character skeleton for right-hand weapon placement
  • a duplicated rifle mesh and rifle skeleton in project content
  • a LeftHandGrip socket on the duplicated rifle
  • an Animation Blueprint variable that reads the grip socket transform
  • a Control Rig that moves the left arm toward that transform
  • an alpha value that disables the IK when no valid rifle grip exists

The example paths in this guide use the Shenya setup:

AssetPath
Character Blueprint/Content/ALS_Shenya/B_Als_Shenya
Animation Blueprint/Content/Shenya2/Meshes/ABP_Shenya
Left-hand Control Rig/Content/Shenya2/Meshes/CR_Shenya_LeftHandIK
Custom rifle skeleton/Content/ALS_Shenya/Overlay_Objects/Rifle/SK_Als_Rifle_Shenya
Custom rifle mesh/Content/ALS_Shenya/Overlay_Objects/Rifle/SKM_Als_Rifle_Shenya

The rifle is an ALS overlay object. In the default ALS setup, overlay objects are built around the ALS character mesh and ALS skeleton. After adding a custom character mesh, the rifle can still be attached to the hidden ALS driver mesh or to a socket that does not line up with the visible character.

That creates this kind of result:

Rifle before alignment
Rifle before alignment

For a custom character, the safer setup is:

  • keep ALS driving locomotion as before
  • attach the rifle to a socket on the visible character skeleton
  • use a separate grip socket on the rifle for left-hand IK

This avoids depending on the ALS weapon bone for the visible weapon placement.

1. Attach the Rifle to the Visible Character Mesh

Section titled “1. Attach the Rifle to the Visible Character Mesh”

1. Create a Rifle Socket on the Character Skeleton

Section titled “1. Create a Rifle Socket on the Character Skeleton”

Open your custom character skeleton, find the right-hand bone, then create a new socket named:

Rifle
Create Rifle socket on character skeleton
Create Rifle socket on character skeleton

This socket becomes the attachment point for the rifle on the visible character.

2. Disable Gun-Bone Attachment for Overlay Objects

Section titled “2. Disable Gun-Bone Attachment for Overlay Objects”

Open the custom character Blueprint:

/Content/ALS_Shenya/B_Als_Shenya

Find this variable:

bUseGunBoneForOverlayObjects

Disable it.

Disable use gun bone
Disable use gun bone

Why this matters:

  • when this is enabled, the overlay object can use the ALS gun-bone attachment path
  • when this is disabled, the character can use the socket-based attachment path instead
  • for a custom character skeleton, a socket on the visible character skeleton is easier to inspect and tune

3. Change the Attachment Target in AttachOverlayObject

Section titled “3. Change the Attachment Target in AttachOverlayObject”

In /Content/ALS_Shenya/B_Als_Shenya, open:

AttachOverlayObject
Open AttachOverlayObject
Open AttachOverlayObject

This function contains Attach Component To Component nodes for the overlay object attachment paths. It also receives:

  • NewStaticMesh
  • NewSkeletalMesh
  • NewAnimationClass
  • SocketName
  • bUseLeftGunBone

For the rifle path, make sure the attach parent is your visible character mesh component, not the hidden ALS driver mesh.

Replace ALS mesh attachment target
Replace ALS mesh attachment target

What this changes:

  • before: the rifle attaches to the ALS driver mesh
  • after: the rifle belongs to the visible character mesh and uses the Rifle socket created on the custom skeleton.

Compile the Blueprint and test in play mode.

The first result often looks incorrect because the socket exists but has not been aligned yet:

First rifle test
First rifle test

To tune the socket:

  1. press F8 to eject from the player during PIE
  2. position the camera so the rifle and right hand are visible
  3. open the character skeleton
  4. select the Rifle socket
  5. move and rotate the socket in the skeleton viewport
Move and rotate the rifle socket
Move and rotate the rifle socket

Use larger grid or rotation snap values while blocking in the placement:

Snap options
Snap options

If the animation keeps changing while you are adjusting the socket, pause the game and advance one frame at a time:

Pause and advance frame
Pause and advance frame

After tuning, the rifle should sit closer to the right hand:

Rifle after right-hand adjustment
Rifle after right-hand adjustment

At this stage, only focus on the weapon’s overall right-hand placement. The left hand will be fixed separately.

1. Duplicate the Rifle Into Project Content

Section titled “1. Duplicate the Rifle Into Project Content”

The left-hand IK needs a socket on the rifle. Do not add custom sockets directly to the plugin rifle assets unless you intentionally want to edit plugin content.

The original ALS rifle assets are under:

/ALS/ALS/OverlayObjects/Rifle

Copy the rifle skeleton and skeletal mesh into your own project content folder, for example:

/Content/ALS_Shenya/Overlay_Objects/Rifle
Duplicate rifle mesh and skeleton
Duplicate rifle mesh and skeleton

Rename the duplicated assets clearly:

AssetExample name
Rifle skeletonSK_Als_Rifle_Shenya
Rifle skeletal meshSKM_Als_Rifle_Shenya

Then assign the duplicated mesh to the duplicated skeleton:

  1. right-click the duplicated rifle mesh
  2. choose Skeleton > Assign Skeleton
  3. choose the duplicated rifle skeleton
Assign custom skeleton to duplicated rifle mesh
Assign custom skeleton to duplicated rifle mesh

Open the duplicated rifle skeleton or rifle mesh and create a socket named:

LeftHandGrip
Add LeftHandGrip socket to rifle
Add LeftHandGrip socket to rifle

Place it where the support hand should grip the weapon.

LeftHandGrip rough placement
LeftHandGrip rough placement

This socket is not the weapon attachment socket. It is a target for the left hand.

The distinction is important:

SocketAssetPurpose
Riflecharacter skeletonattaches the rifle to the right hand
LeftHandGriprifle skeleton or rifle meshtells IK where the left hand should move

Do not spend too long perfecting the LeftHandGrip socket before the Control Rig is connected. Once IK is active, it is easier to see the final hand placement and adjust the socket in context.

Create a Control Rig from your custom character skeletal mesh.

In the example setup, the Control Rig is:

/Content/Shenya2/Meshes/CR_Shenya_LeftHandIK
Create Control Rig
Create Control Rig

In the Control Rig graph, add a Basic IK node and connect it to the forward solve path:

Create Basic IK node
Create Basic IK node

For the Shenya skeleton, use this left arm chain:

Basic IK fieldValue
Item Aupperarm_l
Item Blowerarm_l
Effector Itemhand_l

If your character skeleton uses different bone names, use the matching left upper-arm, lower-arm, and hand bones from your skeleton.

Set the Basic IK secondary axis so the arm bends in the expected direction. In this setup, Secondary Axis Y is set to:

-1.0

The secondary axis affects how the IK solver interprets the limb bend direction:

Basic IK secondary axis comparison
Basic IK secondary axis comparison

Create a Control Rig variable:

LeftHandGrip

Set its type to:

Transform

Expose it so the Animation Blueprint can pass the rifle grip transform into the Control Rig.

Create LeftHandGrip variable in Control Rig
Create LeftHandGrip variable in Control Rig

Connect LeftHandGrip to the IK effector transform.

The graph should follow this shape:

Control Rig setup
Control Rig setup

This Control Rig has one narrow job: move the left arm chain so the hand reaches the grip transform supplied by the Animation Blueprint.

4. Feed the Grip Transform from the Animation Blueprint

Section titled “4. Feed the Grip Transform from the Animation Blueprint”

Open the custom Animation Blueprint:

/Content/Shenya2/Meshes/ABP_Shenya

This Animation Blueprint needs two variables:

VariableTypePurpose
LeftHandGripABPTransformstores the rifle grip transform in character-local space

In the AnimGraph, the pose flow is:

Retarget Pose From Mesh -> Control Rig -> Output Pose

The Control Rig node receives LeftHandGripABP:

AnimGraph Control Rig setup
AnimGraph Control Rig setup

In the Event Graph, update the grip transform during Event Blueprint Update Animation.

The Event Graph should do this:

  1. gets the owning pawn
  2. casts it to B_Als_Shenya
  3. reads the character’s OverlaySkeletalMesh
  4. checks Does Socket Exist for LeftHandGrip
  5. if the socket exists, reads Get Socket Transform
  6. converts the transform with Make Relative Transform
  7. stores the result in LeftHandGripABP
  8. sets LeftHandIKAlpha to the enabled value
  9. if the socket does not exist, sets LeftHandIKAlpha to the disabled value
AnimBP Event Graph setup
AnimBP Event Graph setup

The key safety check is Does Socket Exist. Without it, the Animation Blueprint can feed a stale or default transform into the Control Rig when the rifle is not equipped.

5. Switch the Rifle Overlay to the Custom Rifle

Section titled “5. Switch the Rifle Overlay to the Custom Rifle”

The left-hand setup will not work if the character is still using the original ALS rifle mesh, because the original rifle does not contain the custom LeftHandGrip socket.

Open:

/Content/ALS_Shenya/B_Als_Shenya

Then open:

RefreshOverlayObject

This function uses a Gameplay Tag switch for overlay modes. The rifle branch calls AttachOverlayObject.

For the rifle branch, set the New Skeletal Mesh input to:

/Content/ALS_Shenya/Overlay_Objects/Rifle/SKM_Als_Rifle_Shenya
Set custom rifle mesh in character Blueprint
Set custom rifle mesh in character Blueprint

Now, when rifle overlay mode is selected, the character uses the duplicated rifle mesh that contains LeftHandGrip.

Test in play mode. The left hand should now react to the rifle, but the pose may still need socket tuning:

Left hand first IK test
Left hand first IK test

Adjust the LeftHandGrip socket on the duplicated rifle until the support hand sits correctly.

Left hand after grip tuning
Left hand after grip tuning

Example LeftHandGrip socket values from the Shenya rifle setup:

(Pitch=34.987129,Yaw=90.000000,Roll=191.700000)
(X=2.812969,Y=10.259873,Z=-4.514576)

Use those values only as a reference point. Different character proportions, rifle proportions, and skeleton orientations need different socket transforms.

After the hand reaches the rifle, the elbow can still bend in an undesirable direction.

Before pole vector
Before pole vector

A pole vector gives the IK solver an extra direction hint. The hand target tells the solver where the wrist should go; the pole vector helps decide which way the elbow should point while reaching that target.

Without a useful pole vector, the arm can collapse inward, twist toward the body, or flip as the character rotates.

In the Control Rig hierarchy:

  1. find spine_03
  2. right-click it
  3. choose New Element > New Control
Create new control from spine_03
Create new control from spine_03

Move the control away from the body in the direction you want the elbow to prefer.

In the example, the control is offset from spine_03. If your rig orientation differs, the useful axis may not be the same. The important result is that the control sits to the side of the character, not directly inside the arm chain.

Offset pole vector control
Offset pole vector control

2. Connect the Control to the Basic IK Pole Vector

Section titled “2. Connect the Control to the Basic IK Pole Vector”

Drag the new control into the graph as a Get Transform - Control node.

Expand the transform output and connect its Translation to the Basic IK node’s Pole Vector input.

Set Pole Vector Kind to Location

Connect control to pole vector
Connect control to pole vector

Compile and test again.

The elbow should now bend more consistently:

After pole vector
After pole vector

7. Disable Left-Hand IK When No Grip Socket Exists

Section titled “7. Disable Left-Hand IK When No Grip Socket Exists”

The Control Rig should not keep pulling the left hand toward a grip target when the current overlay object does not provide one.

The Animation Blueprint handles this with LeftHandIKAlpha:

  • if OverlaySkeletalMesh has a LeftHandGrip socket, update LeftHandGripABP and enable the IK
  • if it does not, disable the IK

This prevents the left arm from being pulled by a default, missing, or stale grip transform.

Before the activation fix, the arm can enter an incorrect pose when the rifle grip is not available:

Before Control Rig activation fix
Before Control Rig activation fix

1. Set LeftHandIKAlpha in the Animation Blueprint

Section titled “1. Set LeftHandIKAlpha in the Animation Blueprint”

In /Content/Shenya2/Meshes/ABP_Shenya, keep the socket check in the Event Graph.

When Does Socket Exist returns true for LeftHandGrip:

  • update LeftHandGripABP
  • set LeftHandIKAlpha to the enabled value

When it returns false:

  • set LeftHandIKAlpha to the disabled value
AnimBP event graph with IK alpha
AnimBP event graph with IK alpha

2. Pass the Alpha into the Control Rig Node

Section titled “2. Pass the Alpha into the Control Rig Node”

In the AnimGraph, expose the Control Rig input pin for the alpha and connect the Animation Blueprint variable.

AnimBP anim graph with Control Rig alpha
AnimBP anim graph with Control Rig alpha

Create a matching exposed alpha variable in the Control Rig and use it to control the IK influence.

Control Rig graph with activation alpha
Control Rig graph with activation alpha

After this setup, the left-hand IK only affects the pose when a valid LeftHandGrip socket is available.

After Control Rig activation fix
After Control Rig activation fix

At the end of this setup:

  • the rifle attaches to a Rifle socket on the visible character skeleton
  • the rifle overlay uses a duplicated project-owned rifle mesh
  • the duplicated rifle provides a LeftHandGrip socket
  • the Animation Blueprint reads the grip socket from OverlaySkeletalMesh
  • the Control Rig moves the left arm toward the grip
  • the pole vector gives the elbow a stable bend direction
  • LeftHandIKAlpha disables the left-hand correction when the grip socket is not available

This keeps the weapon alignment data close to the assets that need it: right-hand placement lives on the character skeleton, and left-hand grip placement lives on the weapon.