Getting Started

Introduction

Installation

Project Configuration

Testing in Your Sandbox

Samples & Examples

Core Concepts & Glossary

Package Types

Spaces & Space Templates

Custom Avatars

Custom Avatar Animations

Avatar Attachments

https://youtu.be/Fcb-YaZeMC0

Custom Avatars

<aside> <img src="/icons/star_green.svg" alt="/icons/star_green.svg" width="40px" /> If you are new to the Creator Toolkit, make sure to check out following page to get your Unity editor setup!

</aside>

<aside> <img src="/icons/book_gray.svg" alt="/icons/book_gray.svg" width="40px" /> This component allows for defining a custom avatar to be used in Spatial. This is to be used in conjunction with the Avatar package type, which you can reference in the package configuration.

</aside>

How To Use

<aside> 💡 Before setting your avatar up, it’s important to know what purpose the avatar will be used for. There are certain restrictions on how detailed your avatar can be, which depends on whether it will be used globally across Spatial, or within your own spaces.

</aside>

<aside> ⚙ Find examples of custom avatars in the Starter Template

</aside>

Sample avatar in the sandbox

Sample avatar in the sandbox

  1. Import a rigged, humanoid 3D model (preferably .fbx format) into Unity. This model does not need to have animations, but if there are some, you may add them through the Avatar Animation package and component. Ensure that the Animation Type under the Rig tab is set to Humanoid.

    Untitled

  2. Create a prefab from this model. You can do so easily by right clicking the asset and selecting Create > Prefab Variant.

    Untitled

  3. Add the Spatial Avatar component to this newly created prefab.

    Untitled

  4. Create a new Avatar package under Project Configuration and drag the prefab into the Prefab field. You will also need to supply a thumbnail of size 256x256 in an uncompressed format. The background should be transparent.

    Untitled

  5. To test this package, make sure it is the “active package” inside the project configuration panel and then press the Test Active Package button inside the main toolbar.

    Untitled

Custom Animation Sets

Avatars can come with fully custom animations for walking, jumping etc.

Untitled

Importing Animations

Either you will create your own animations in an application like Blender, or you can find some pre-made ones on services like Mixamo.

  1. Copy your FBX into your unity project

  2. In the “Rig” tab of the animation model import settings, select “Humanoid” rig type.

    1. If the animation was created specifically for your avatar, then you can re-use the “Unity Avatar” from your original avatar model. This is recommended because animations will properly be “targeted” to your avatar. This avoids hands clipping through the body and legs.

      Untitled

  3. In the “Animation” tab, it is good practice to give your animation a good name:

    Untitled

  4. Next, depending on the animation clip type, you will want to set the animation to loop. For animations that loop (walk, jog, run, fall) you will need to turn this on to be able to publish.

    Untitled

  5. Play around with all the other settings like “Root Transform Rotation”, “Root Transform Position (Y)” and “Root Transform Position (XZ)” if your animations don’t look right.

Setting Animations for your Avatar

  1. Now that you have imported a couple of animations into your project you can assign them to your custom avatar. Simply drag the animation clip into the correct animation slot

    Untitled

Limitations

To be able to support multiple platforms, including mobile devices, there are restrictions in place to help ensure performance is stable for everyone.

These limitations are subject to change at any time.

Global Avatar Ecosystem Avatar
Triangle Count 22,500 200,000
Vertex Count 50,000 200,000
Texture Size Limit 1024x1024 4096x4096
Submesh (Draw Call) Limit 4 100
Physical Dimensions Limit 2.5m x 2.5m x 2.5m 25m x 25m x 25m
Rig Type Humanoid Humanoid

Avatar Scope

Universal Avatars

World Avatars

Building Your Own Original Avatar Model

Check out this great tutorial video for adding a rig/bones to your own 3D avatar model using Blender:

https://www.youtube.com/watch?v=9dZjcFW3BRY

Also check out https://www.mixamo.com/ for automatic character rigging.

Resources: Example Avatar Models

These are great resources for avatar models you can try and use in Spatial!

Note, not all of these models are guaranteed to work - they may need modification/optimization, rigging, or other changes before they can be imported into Spatial.

Sketchfab

Avatars - A 3D model collection by Jake Steinerman (@jasteinerman)

ActorCore

Handling Errors When Publishing Your Avatar

The Avatar Has Too Many Vertices or Triangles

Global avatars can have a maximum of 22,500 triangles.

If yours has more than this, we recommend optimizing your file to reduce the number of triangles and vertices. The Decimate Modifier in Blender is a great option:

https://www.youtube.com/watch?v=JqoIGxUrLbw

The Avatar Has Too Many Sub-meshes

Global avatars can have a maximum of 4 sub-meshes.

If you receive the error that your avatar has too many sub-meshes (>4), one approach to solving that problem is combining the material in your model. You can follow this tutorial to reduce the sub-meshes in your model:

https://www.youtube.com/watch?v=6yhxfxcHH54

The Avatar Must have a Valid Humanoid Rig

In Spatial, your avatar must have 2 arms and 2 legs - a.k.a. “Humanoid”.

If your model already has a Humanoid rig, in Unity click on your avatar in the Project tab, and in the Inspector go to Rig. Under “Animation Type” choose Humanoid, and then Configure.

Untitled

If you receive an error when configuring your rig in Unity, or do not have a Humanoid Rig set up for your avatar, follow this tutorial to set it up:

https://www.youtube.com/watch?v=9q5I3cyYS2Y

The Scale of All Child GameObjects of the Avatar Must be Normalized

We enforce all child GameObjects of the avatar to have a normalized transform scale of (1, 1, 1). This is so that Avatar Attachments have consistent behavior across all published avatars.

If the root of your avatar’s rig/bone hierarchy (usually the Hip bone) is the only GameObject with a non-normalized scale, you can fix this by changing the Scale Factor under the Model Importer settings. Click on your avatar model in the Project tab and in the Inspector, select Model. Multiply the existing Scale Factor by the scale of your root object and click Apply. After applying the changes, you may need to recreate your avatar prefabs by dragging the model into the hierarchy again, as changing the scale factor may distort the avatar.

In this example, the Scale Factor was previously 1, and the transform scale of the hip bone was (90, 90, 90). Multiply Scale Factor by 90, then reset the root bone transform to (1, 1, 1), which will cause your avatar to return to a normal size.

In this example, the Scale Factor was previously 1, and the transform scale of the hip bone was (90, 90, 90). Multiply Scale Factor by 90, then reset the root bone transform to (1, 1, 1), which will cause your avatar to return to a normal size.

If there are multiple nested GameObjects in the avatar’s hierarchy that do not have normalized scale, you will need to go into a 3D modeling program (such as Blender) to fix it manually. This involves resetting the transform of each bone by Applying Delta Transforms and Applying Scale, so that the physical size is maintained when the transform scale is changed.

In the case of a manually rigged avatar, redoing the rig of the model is an alternative solution which can even be the least amount of effort in some cases. Deleting the existing rig completely and using Mixamo’s auto-rigging tool should create a rig with all bone transforms standardized. This is a last resort option — ideally someone with animating experience will fix the existing rig if it’s mostly okay.

← Previous

Spaces & Space Templates

Next →

Custom Avatar Animations