-
Notifications
You must be signed in to change notification settings - Fork 1
Step 4: Installation ‐ Player AnimBP
In this section, we add the Possessable System to the player’s Animation Blueprint. We will only prepare the required references and nodes so they can be used inside the AnimBP.
- In the Content Browser, locate the Player Animation Blueprint (e.g.
ABP_Manny). - Double-click it to open.
We will fetch the CharacterSeatHandler from the character when the AnimBP starts and store it in a variable.
- Right-click in the AnimBP Event Graph panel.
- Search for Blueprint Begin Play and add the event.
- Get the character reference and call Get Seat Link (Message).
- From the Seat Link output pin, right-click and select Promote to Variable.
- The setup should look like the image below.
The Seat Handler is now accessible inside the Animation Blueprint.
You can now use the following nodes inside the AnimBP:
-
Seat Fully Entered Checks whether the character is fully seated on a mount.
-
Current Use Two Hand IK Determines whether the character’s arms should be attached to any part of the mounted actor.
-
Two Hand IK Index The index of the seat used for arm attachment.
First, we need to store whether the character is seated inside the AnimBP.
- In the Event Blueprint Update Animation event, call SeatFullyEntered from the Seat Handler.
- Save the result to a boolean variable.
The setup should look like this:
The Animation Blueprint now knows whether the character is seated on an actor.
If the character’s arms will be attached to parts of the mounted actor, we need to define related variables in the AnimBP.
- Create a function named BoneSettings.
- Inside this function, define and set the variables as shown below.
- Call this function when SeatFullyEntered is set, as shown below.
Now, let’s add an Animation Layer to control the character’s arms.
- Create a new Animation Layer (the name is optional, we used
IK_Possesable_Layer). - Open the
IK_Possesable_Layerfunction. - From the Details panel, add a new input.
- Cache the input so it can be reused later.
To avoid unnecessary processing, we disable this logic when it’s not needed:
- Add Blend Poses by Bool to the output.
- Control it using UseTwoHandIK from the Seat Handler.
- Connect the previously added BoneConnector node to the False input.
The purpose here is to avoid unnecessary calculations when the character is not seated or when the current seat does not use arm attachment. Sending an empty pose reduces processing cost.
- Add Two Bone IK and Transform (Modify) Bone nodes.
- Connect them to the True input of Blend Poses by Bool.
- Configure Two Bone IK and Transform (Modify) Bone settings from the Details panel as shown below.
This setup is for the right hand.
- Duplicate the Two Bone IK and Transform (Modify) Bone nodes and apply the same logic for the left hand.
Final result:
- Finally, feed the transforms configured in the BoneSettings function into these nodes.
We’ve reached the final stage of the Animation Blueprint setup.
- Open the AnimGraph panel.
- Right-click on an empty area and search for
ABP_Anim_Graph_Mount. - Select the
ABP_Anim_Graph_Mountfunction.
- Select the added function and, from the Details panel, enable Expose As Pin for
SeatLink.
- Connect
ABP_Anim_Graph_MountandIK_Possesable_Layer, then cache the result.
Final layout:
- Connect a Blend Poses by Bool node to the Output Pose.
Since animation montages will be used later, make sure to connect the montage slot (e.g. DefaultSlot) after the Blend Poses by Bool node.
You can use any slot name that fits your setup.
Below is an example of the final setup with all nodes connected:
Note: All of these setups are included in the sample project. You can either copy the code directly or review the project to understand how everything is implemented.