Lyra project integration example
Demo of Ready Player Me Avatars integrated with the UE5 Lyra project.
Last updated
Demo of Ready Player Me Avatars integrated with the UE5 Lyra project.
Last updated
The Lyra example is Unreal Engine only content and may not be used outside of its ecosystem. Ready Player Me is not affiliated with Epic Games.
Lyra is a full-fledged project that demonstrates many of Unreal Engine's features and capabilities. Familiarize yourself with an overview of the project in the Unreal Engine Lyra Sample Game documentation.
Lyra is a learning resource designed as a sample game project to help you understand the frameworks of Unreal Engine 5 (UE5). Learn more about the Lyra project in the Unreal Engine Lyra Sample Game documentation.
The original Lyra Project uses the UE5 skeleton for gameplay. It contains complex animations, and it uses IK and control rigs that heavily depend on the UE5 skeleton.
By default, the Ready Player Me skeleton is not compatible with UE4 and UE5 skeletons as it contains different bone names and a different hierarchy.
However, it is possible to retarget all the animations and change the control rigs so that the Ready Player Me characters work correctly. This is time-consuming.
Instead, this example demonstrates the following strategy.
Animations via runtime IK retargeting.
Use an invisible actor to control the character
Retarget the animations from this actor to the ReadyPlayerMe avatar.
Download the project, unzip it (this takes some time), and open the project Unreal Engine 5 (this also takes some time).
Download the Windows build of the finished Ready Player Me demo, unzip it, and run Windows/LyraGame.exe.
Unzip and open the LyraRpmExample project in Unreal Engine 5.
You may not have the exact same version of UE5. If prompted, rebuild the project. This may take some time.
Inside the Content > Characters folder, if it doesn't exist, create a new folder and call it ReadyPlayerMe.
Inside the Content > Character > Cosmetics folder, find the B_Manny actor blueprint. Along with B_Quinn, these are the characters spawned at runtime in the actual game.
Duplicate B_Manny, rename it to B_RPM, and move it to the new ReadyPlayerMe folder.
In the B_RPM actors Details panel, add the ReadyPlayerMe component to load the avatars at runtime.
Select the ReadyPlayerMe component and in the Details panel:
Set the Url shortcode of the avatar
Set the target skeleton to RPM_Mixamo_Skeleton.
[Optional] Add an avatar config. You can use Characters > ReadyPlayerMe > Data > DA_AvatarConfig (Optionally edit the avatar config and set the Texture Atlas to High for fewer draw calls.)
Open the Event Graph for B_RPM.
Right-click to add nodes. Uncheck Context sensitive to see all Ready Player Me functions.
Add an EventBeginPlay node.
Add a LoadAvatar function node. Pick the function that targets the Ready Player Me Component.
Connect BeginPlay to LoadAvatar.
Drag the ReadyPlayerMe component into the graph and make it the target.
Next, you need an IK Retargeter that will retarget the animations from UE5 Manny to the RPM avatar. For this example, it is provided for you. To learn more about how to create IK Rig and IK Retargeter, check the following example to see how this was done.
Open Characters > ReadyPlayerMe > Rigs > IK_RPM_FullBody.
In the details, notice that it's using the RPM_Mixamo_SkeletalMesh.
Open the Characters > ReadyPlayerMe > Rigs > RTG_UE5Manny_RPM_FullBody IK Retargeter. Notice that its Target IKRig Asset is set to IK_RPM_FullBody.
Lyra's character holds a weapon with both hands. The hands of the Ready Player Me avatar must be in exactly the same position as that driving mannequin's hands. To achieve this we adjust some settings in the IK Retargeter.
In the Retargeter Details panel, find Blend to Source property and set it to 1.0, if not already set.
Next, we need an animation blueprint for the Ready Player Me avatar. This example provides you with one.
Open the ReadyPlayerMe > Animations > ABP_RPM_Mannequin_Retarget Animation Blueprint.
In the AnimGraph, create a Retarget Pose From Mesh node and connect it with the Output Pose node. In the example, this is already done for you.
Click on RetargetPoseFromMesh node and in the Details panel verify that Use Attached Parent is checked.
Also set the IKRetargeterAsset to the RPM_IK_Retargeter that we created: RTG_UE5Manny_RPM_FullBody. In the example, this is already done for you.
Save your work so far if you haven't already.
Open the B_RPM actor again and select its MeshComponent.
In Details, under Animation, set the animation class to the ABP_RPM_Mannequin_Retarget animation blueprint.
Right-click the Skeletal Mesh icon and select Clear.
Setting the Skeletal Mesh to None is important, as runtime changing of the mesh breaks the skeletal mesh component.
Next, you need to spawn the Ready Player Me characters instead of the B_Manny versions. You can duplicate your avatar and create several versions and they will be randomly chosen.
Go to ReadyPlayerMe > Blueprints where this has been done for you in this example.
Random avatar spawning
To have Ready Player Me characters randomly chosen when spawning characters you can:
Open the Content > Character > Cosmetics > B_PickRandomCharacter blueprint class.
In the EventGraph, find the Select node, change to options to use the B_RPM blueprints, as shown in the image. In this example, this has been done for you.
Enable Avatar caching from the project settings to get better performance and load avatars faster without the need to download them every time.
To enable this setting go to Edit > Project Settings > Game > ReadyPlayerMe > Avatar Caching > Enable Avatar Caching.
Although the Niagara effects look great in the editor, they cause a crash on the built applications. This is a limitation connected with the glTFRuntime external library. You must disable the Niagara effects that are applied to the character by disabling the Spawn, Teleport, and Death GameplayCues.
Use Search in Content to find these quickly as they are all over the place.
Open the GE_SpawnIn Blueprint and remove Gameplay Cues > Character > Spawn --> This is already done.
Open the B_Teleport Blueprint and remove GameplayCue > World > Teleporter > Activate -> This is already done.
Open the GA_Hero_Death Blueprint and remove GameplayCue > Character > Death -> This is already done.
In Project Settings Additional Asset Directories to Cook, add the /glTFRuntime
folder.
If you do not add glTFRuntime into the Additional Asset Directories to Cook setting you will likely have issues with missing materials when loading avatars on built applications.
Edit B_RPM. In the Event Graph, there is a notice. The important part is that CopyPose is used for B_Manny.