How it works

Here you will learn how the ReadyPlayerMe Unreal plugin works

Requirements

  • The Plugin supports Unreal Engine 4.25 or 4.26

  • A valid avatar URL created from Ready Player Me to import an avatar to an Unreal scene.

Included in our zip file is a free third party plugin called glTFRuntime which is required for importing glTF files and that only supports Engine versions 4.25 and 4.26

Inside the blueprints

Loading an avatar into our demo scene is great but most likely you will want to know how it all works and more importantly how you can implement it into your games and other applications. To get started, let's open up the BP_ReadyPlayerMeActor blueprint. Firstly, let's look at the first 3 nodes connected to the BeginPlay node as shown below.

As the name suggests this runs as soon as you hit play and first we need to get a preconfigured runtime config using RPM Get Full Body Runtime Config. This is a custom helper function to save you from having to create the config yourself. However, we will also cover how to do that later on in this guide. This config handles some of the loaded .gltf scene scale and 3D transform properties.

Once we have the config we can pass it to the most important node of all glTF Load Asset From Url. This node is part of the third-party Unreal editor plugin glTFRuntime. As you can see it is passed the public Url property as a parameter as well as the LoaderConfig parameter which we specifically need for ReadyPlayerMe avatars to load correctly for animation purposes.

It's worth noting that while glTF Load Asset From Url loads the asset, it does not spawn it in the scene it simply loads the data from the URL and stores it in a format we can then use.

Lastly, it has a Completed callback function which we will use to actually load the avatar model assets into the scene.

The OnAssetLoaded function below is connected to the Completed callback function parameter mentioned above. This is run once the avatar has finished loading from the web and returns a custom type of asset called a glTFRuntimeAsset which contains all the data loaded from the ReadyPlayerMe .gltf file.

Once the asset has been loaded we check whether the loaded asset is full-body or half-body avatar. If it's a half-body avatar then it just loads in with the helper function RPM Setup Half Body Skeleton node. Alternatively, if it's full-body it loads the model with the RPM Setup Fullbody Skeleton node. Both of these nodes handle the loading of all the meshes, materials, and skeleton and adding it to the Target actor, which defaults to self if nothing is assigned.

Note that the RPM Setup Full Body Skeleton node has a Skeleton parameter. It is important that this is set to RPM_MicamoSkeleton as this is used for retargeting from our reference skeleton we have included in the plugin. Without this, the animations won't work correctly.

Lastly, after loading the full-body skeleton we set the avatar up for animation but setting the animation blueprint with RPM Set Full Body Animation Blueprint. This is another helper function and it takes in the public property AnimBlueprintInstance which can be set in the inspector of the actor.

If you want to see exactly what our RPM helper functions do you can find the C++ class files in [PROJECT_NAME/Plugins/ReadyPlayerMe/Source/ReadyPlayerMe/Private.

‚Äč

Further Learning

If you would like to understand the avatar loading function logic further in blueprint format there is also a BP_ManualExampleActor you can reference. In this event graph, you will see how the logic behind our ReadyPlayerMeFunctionLibrary helper functions can be applied manually via the Blueprint system.