ad
ad

Custom Avatars: Unity

Howto & Style


Custom Avatars: Unity

Creating custom avatars for your game can be an enriching process. Follow the step-by-step guide below to bring a model to life in Unity, prepare it for VR use, and correct its dimensions and behaviors.

Initial Setup

  1. Create the Parent Object

    • First, create the parent object and set the position to zeros across all axes.
    • Attach the child components (your model and others) to this parent object.
  2. Model Configuration

    • Select your model, ensure all textures and materials are in place.
    • In the material section, set it to use external materials, legacy.
    • Set the rig to humanoid and click 'Apply'. Your model should now be properly textured.

Setting Up Reference

  1. Create a Reference Cube
    • This cube will act as a height reference for your model.
    • Set 'Y' scale to 1.8 and 'Y' position to 0.9.
    • Use this cube like a measuring stick to adjust your avatar's size correctly.
    • Drag the avatar model onto the parent object, then scale the model to fit the cube by eyeballing it.
    • Delete the reference cube once done.

Hand Configuration

  1. Clasp the Hands
    • Use the blend shapes feature to clasp the hands so they can grab the sabers in-game.

Creating Empties

  1. Create Empty Game Objects
    • On the parent object, create four empties:
      • One for the head (right ahead of the eyes)
      • One for the body (position zeroed out)
      • One for each hand (left and right)
    • Position and rotate them correctly:
      • Head: Centered in front of the eyes.
      • Hands: Centered in both fists. Ensure the rotation faces the wrist for correct saber orientation.
    • Copy and mirror the left hand configuration to create the right hand setting by reversing the x-value and z-rotation.

Configuring VR Integration

  1. Adding IK and VR Scripts
    • Add the 'IKManager' and 'VRIK' scripts. These scripts will manage the correct IK (Inverse Kinematics) positions in the game.
    • Create empty game objects exactly where each wrist and head are located, then drag them to the respective hand or head empties.
    • Rename these to 'leftHandTarget', 'rightHandTarget', and 'headTarget'.
    • In 'IKManager', populate these targets, which will be used by the 'VRIK' script.

Finalizing and Exporting

  1. Avatar Descriptor
    • Add an avatar descriptor to the parent object. Fill in the avatar's name and author.
    • Before exporting, ensure that all shaders are set to Beat Saber-compatible shaders to prevent rendering issues in-game.
    • Open the avatar exporter window, check everything is in order, and export to your custom avatars folder.

After exporting, your custom avatar should be ready and appear correctly in your game.


Keywords

  • Custom Avatars
  • Unity
  • Parent Object
  • Textures
  • Materials
  • Humanoid Rig
  • Reference Cube
  • Clasp Hands
  • Blend Shapes
  • Empties
  • IKManager
  • VRIK Script
  • Beat Saber-compatible shaders
  • Avatar Descriptor

FAQ

  1. Why do I need to set the position of the parent object to zeros?

    • Setting the parent object's position to zeros serves as a reset point, ensuring that all child components, like the model and other attachments, align correctly.
  2. What is the purpose of the reference cube?

    • The reference cube helps you scale your avatar to the correct height, ensuring it fits well within the game’s environment.
  3. Why is it important to rotate the hand empties?

    • Proper rotation of the hand empties ensures that any items the avatar holds (like sabers) appear in the correct orientation.
  4. What role do the IKManager and VRIK scripts play?

    • These scripts manage the avatar’s inverse kinematics, providing realistic movement and positioning of the avatar’s limbs and head in the game.
  5. Why do I need to check the shaders before exporting?

    • Ensuring the shaders are set to Beat Saber-compatible shaders prevents rendering issues, meaning your avatar will appear correctly in the game.