Lyra project integration example

Demo of Ready Player Me Avatars integrated with the UE5 Lyra project.

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.

The Lyra Project

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.

Lyra and Ready Player Me avatars

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 Ready Player Me sample project

Character

  1. Unzip and open the LyraRpmExample project in Unreal Engine 5.

  2. You may not have the exact same version of UE5. If prompted, rebuild the project. This may take some time.

  3. Inside the Content > Characters folder, if it doesn't exist, create a new folder and call it ReadyPlayerMe.

  4. 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.

  5. Duplicate B_Manny, rename it to B_RPM, and move it to the new ReadyPlayerMe folder.

  6. In the B_RPM actors Details panel, add the ReadyPlayerMe component to load the avatars at runtime.

  7. Select the ReadyPlayerMe component and in the Details panel:

    1. Set the Url shortcode of the avatar

    2. Set the target skeleton to RPM_Mixamo_Skeleton.

    3. [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.)

  8. Open the Event Graph for B_RPM.

  9. Right-click to add nodes. Uncheck Context sensitive to see all Ready Player Me functions.

  10. Add an EventBeginPlay node.

  11. Add a LoadAvatar function node. Pick the function that targets the Ready Player Me Component.

  12. Connect BeginPlay to LoadAvatar.

  13. Drag the ReadyPlayerMe component into the graph and make it the target.

Animation Retargeter

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.

  1. Open Characters > ReadyPlayerMe > Rigs > IK_RPM_FullBody.

  2. In the details, notice that it's using the RPM_Mixamo_SkeletalMesh.

  3. 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.

  1. In the Retargeter Details panel, find Blend to Source property and set it to 1.0, if not already set.

Animation Blueprint

Next, we need an animation blueprint for the Ready Player Me avatar. This example provides you with one.

  1. Open the ReadyPlayerMe > Animations > ABP_RPM_Mannequin_Retarget Animation Blueprint.

  2. 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.

  3. Click on RetargetPoseFromMesh node and in the Details panel verify that Use Attached Parent is checked.

  4. 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.

Configure Character

  1. Save your work so far if you haven't already.

  2. Open the B_RPM actor again and select its MeshComponent.

  3. In Details, under Animation, set the animation class to the ABP_RPM_Mannequin_Retarget animation blueprint.

  4. 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.​

Spawn Character

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.

  1. 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:

  1. Open the Content > Character > Cosmetics > B_PickRandomCharacter blueprint class.

  2. 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

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.

Disable Niagara Effects

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.

Packaging

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.

Last updated

Change request #130: Asset API