Head and Eye Movement
By default, avatars generated in the studio support basic head movements (e.g., looking at the player). If you want more detailed head and eye movements (e.g., nodding, blinking, etc.), then it is recommend that you use Realistic Eye Movements as we have already prepared a
.json file for loading head/eye related parameters for
Realistic Eye Movement. It is located at
Once the package has been imported, find the prefab
InworldCharacter, and add the components
In the Inworld AI Unity SDK, after a
.glb model is dragged into the
UnityScene, it will trigger events that lead to
By default, the IAvatarLoader is GLTFAvatarLoader, and it will call
IEyeHeadAnimLoader::SetupHeadMovement() to set up head and eye movement if it exists.
Let's create our own integrations.
2. Implement Interfaces
Monobehavior class that inherits
IEyeHeadAnimLoader. You can name it whatever you want, e.g.,
Let's load that by implementing the interface function.
public class InworldEyeHeadLoader : MonoBehaviour, IEyeHeadAnimLoader
[SerializeField] string m_HeadEyeAsset = "Animations/REMRPM";
public void SetupHeadMovement(GameObject avatar)
EyeAndHeadAnimator eyeHead = avatar.GetComponent<EyeAndHeadAnimator>();
TextAsset textAsset = Resources.Load<TextAsset>(m_HeadEyeAsset);
EyeAndHeadAnimatorForSerialization import = JsonUtility.FromJson<EyeAndHeadAnimatorForSerialization>(textAsset.text);
eyeHead.headBoneNonMecanim = Utils.GetTransformFromPath(avatar.transform, import.headBonePath);
⚠️ Note: We need to set the value of
EyeHeadAnimatorhas not been fully initialized yet, i.e.,
Transformis null. We need to pass the avatar's transform, otherwise it will throw an error.
3. Create and configure prefabs
Create an empty
gameObject. Attach the script
InworldHeadAnimthat you just implemented.
Create a prefab for that object.
Delete the object from the scene.
GLTFAvatarLoaderprefab in your
Assetsfolder, and drag the prefab that you created into the
You can test your avatar's head animation. Once the avatar has been dragged into the scene, check if
and whether the data for the head and eyes has been set.
You can adjust the parameters and observe differences in nodding and blinking behavior. Check the website for more information.