Getting Started
Package Types
Scene Setup
Custom Collision, Layers, and Tags
Key Differences from Standard Unity3D development
Economy
<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>
<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
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
.
Create a prefab from this model. You can do so easily by right clicking the asset and selecting Create > Prefab Variant
.
Add the Spatial Avatar
component to this newly created prefab.
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.
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.
Avatars can come with fully custom animations for walking, jumping etc.
Either you will create your own animations in an application like Blender, or you can find some pre-made ones on services like Mixamo.
Copy your FBX into your unity project
In the âRigâ tab of the animation model import settings, select âHumanoidâ rig type.
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.
In the âAnimationâ tab, it is good practice to give your animation a good name:
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.
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.
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
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 |
Universal Avatars
World Avatars
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.
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
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
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
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.
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
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.
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
Next â