text
stringlengths
0
17.2k
Then in the Event Begin Play node's logic, create a Get Animation Sharing Manager node. Next create a Register Actor and connect the Sharing Manager's Return Value pin to the Register Actor node's Target pin. Create a Self reference variable and connect it to the In Actor pin. Finally, set the character's skeleton as the Sharing Skeleton.
The AnimationSharingStateProcessor class is a specialized Blueprint class that you can use to set the Animation Sharing Setup assets Animation State to control what animation should be played using your Enumeration asset.
To create a new AnimationSharingStateProcessor blueprint, navigate in the Content Browser, use (+) Add and select Blueprint Class.
Use the Search Bar to locate and select the AnimationSharingStateProcessor class, and then the Select button.
Name the blueprint and open it in the Blueprint Editor.
The Animation Sharing State Processor Blueprint should only be used for prototyping. Runtime performance will be greatly improved by using the native implementation as opposed to the Blueprint implementation.
In the Blueprint's Class Defaults panel, select the Animation State Enum drop down menu, and select your Enumeration asset.
After adding your Enumeration asset, you can use the Animation Sharing State Processor blueprint's two Override Functions to reference and drive the animation selection across your crowd of characters.
After creating your Animation Sharing State Processor blueprint, you can assign it In the Animation Sharing Setup asset's State Processor Class property.
Once you assign an Animation Sharing State Processor blueprint to your Animation Sharing Setup asset, you can create an animation state array using (+) Add in the Animation States property and selecting your Enum values from the State properties drop-down menu.
For each Animation State array, add an Animation Setups array using (+) Add, in order to define the animation sequence to play.
Here you can reference a list of the Animation State array properties and a description of their functionality:
Here you can set the Animation States properties, such as the animation sequence to play, and the randomization applied. The following properties are available for each Animation Setups array added to your Animation States property:
You can use the Scalability Setting section of properties in the Animation Sharing Setup asset to define how the animation sharing works across a large number of actors.
Here you can reference a list of the Scalability Settings properties and a description of their functionality:
You will need to set up an Animation Blueprint to handle the blending between the Animation States by referencing the current active pose, From Component and the pose being fed to the Animation Sharing system, To Component. This requires a special class of Animation Blueprint called an Anim Sharing Transition Instance. To create an Animation Blueprint, navigate in the Content Browser, select Animation > Animation Blueprint.
Select the Character's Skeleton, define the AnimSharingTransitionInstance as the animation blueprint's class, and then select Create.
Name and open the asset.
In the Sharing Transition Animation Blueprint's AnimGraph, right-click and search for a From Component transition variable. Then create and connect its output to a Copy Pose From Mesh node. Create and connect the Copy Pose From Mesh node's output to a Blend Poses by bool node's True Pose input pin.
Right-click in the graph and search for a To Component transition variable. Then create and connect its output to a Copy Pose From Mesh node. Connect the Copy Pose From Mesh node's output to the Blend Poses by bool node's False Pose input pin.
Right-click in the graph and search for a Blend Bool transition variable and connect it to the Blend Poses by Bool node's Active Value input pin. Then, right-click in the graph to search for and create a Blend Time variable to reference the Blend Time property in the Animation Sharing Setup asset, and connect it to the True and False Blend Time pins. Then connect the Blend Poses by Bool node's output to the Output Pose node.
Now add the Sharing Transition State Animation Blueprint to the Animation Sharing Setup asset.
You can now transition animation playback when sharing animations across multiple characters.
When using additive animations, you will need to set up an Animation Blueprint to handle the shared Additive Animations. This requires a special class of Animation Blueprint called an AnimSharingAdditiveInstance class.
In order to mark your animations as additive, you will need to enable the On Demand and Additive properties in your Animation Sharing Setup asset on each additive animation's Animation State array.
To create an Additive Animation Sharing Animation Blueprint, navigate in the Content Browser, select Animation > Animation Blueprint.
Select the Character's Skeleton, define the AnimSharingAdditiveInstance as the animation blueprint's class and then select Create.
Name and open the asset.
In the Addictive Animation Blueprint's AnimGraph, right-click and create a Base Component additive variable. From the Base Component variable, create and connect a Copy Pose From Mesh node, and connect its output to an Apply Space Additive node.
Right-click in the AnimGraph and create a Sequence Player node. Select the Sequence Player node and expose its Sequence property as a pin in the graph, by navigating in the Details panel and selecting Expose Pin in the Sequence property.
Right-click in the AnimGraph and create an Additive Animation additive variable, and connect it to the Sequence Player node's Sequence pin. Then connect the Sequence Player node's output to the Apply Mesh Space Additive node's Additive pin. Finally, connect the Apply Mesh Space Additive node's output to the Output Pose node.
You can now add The Additive Animation Blueprint to the Animation Sharing Setup asset.
You can now blend the shared animation as an additive animation.
You can use the Anim Sharing State Instance Animation Blueprint class to run shared animations across your characters. With the Anim Sharing State Animation Blueprint you can add AnimBP behavior to expose two properties by default:
Animation to Play
Permutation Time Offset.
To create an Anim Sharing Animation Blueprint, create a new Animation Blueprint asset using (+) Add in the Content Browser, and select Animation > Animation Blueprint.
Select your skeleton asset, select the AnimSharingStateInstance class from the drop-down menu and then select Create.
Name and open the animation blueprint.
In the AnimGraph, right-click to create a Sequence Player node. In the Sequence Player node's Details panel, expose the Sequence and Start Position properties as pins to the graph, by selecting Expose as Pin in the pin type drop-down menu. Right-click in the graph to create and connect an Animation to Play animation sharing variable to the sequence player node's Sequence pin.
Right-click in the graph to create a Permutation Time Offset animation sharing variable, and connect it to the Sequence Player node's Start Position pin. Finally, connect the Sequence Player node's output to the Output Pose node.
The Animation Sharing Instance Graph's native implementation, exposes GetInstancedActors which returns all AActor(s) that are currently being driven by this state. This ensures all present Notifies are handled correctly and propagated to the unique instances.
This is achieved by overriding HandleNotify and handling it accordingly.
In the Animation Sharing Setup assets, in each Animation State you wish to randomize an animation playback offset, assign the Animation Sharing Animation Blueprint in the Blueprint property. Then set a value in the Num Randomized Instances property.
In order for Animation Sharing to be executed at runtime, you must create an Animation Sharing Manager node that points to your Animation Sharing Setup asset within the Character or Level blueprint. After creating the Animation Sharing Manager node, define your Animation Sharing Setup asset using the drop-down menu in the graph. In this workflow example, the Create Animation Sharing Manager node is added to the Level blueprint.
Here you can reference additional functions you can call that target the Animation Sharing Manager node and a description of their functionality:
You can now add the crowd character to the level and observe its animation playback as animation states are changed.
During Play in Editor (PIE) simulation, you can enable some helpful viewport debug rendering to illustrate how the Animation Sharing plugin works and how it is selecting animations.
Set-Up Animation Sharing
Animation Sharing Debugging