CREATE YOUR WORLD
Players & Characters: Advanced

How to apply custom animation

11min

Let's learn how to import external animation files and apply them to ZEPETO characters.

STEP 1 : Setting up animation

Access the site where you want to download animation. This guide is an example of using the Mixamo site.

📘 Mixamo



Click the desired humanoid animation.

Document image


Download the animation and select the "FBX for Unity (.fbx)" option.

Document image


Drag and drop the downloaded file to the Unity Project panel.

Document image


Click the Rig tab and change the Animation Type to Humanoid.

Document image


❗️ Caution

Without the humanoid setting, it will not be compatible with the ZEPETO character. Make sure to set it up.



Change the Animation > Motion > Root Motion Node option to <Root Transform> to make your character's animation smoother and more realistic.

Document image


STEP 2 : Setting the animator

Clone an animator object associated with an animator variable in the ZepetoPlayers component inspector.

  • File path : Packages/zepeto.character.controller/Runtime/_Resources/AnimatorController/ZepetoAnimatorV2.controller
  • Drag the animator into the Assets folder.
  • After copying, rename it to ZepetoAnimatorV2_Custom.

    Document image
    

    

Click Hierarchy > ZEPETO > ZepetoPlayers to create it, and drag a copy of the animator you created in the Animation Controller field of the ZepetoPlayers component.

Document image


Double-click ZepetoAnimatorV2_Custom to open the animator tab.

  • Drag and drop the new animation into the animator to create an animation state.

    Document image
    

    

  • Right-click the animation state you created, and then click Make Transition to create a transition that returns to the Idle state.

    Document image
    

    

Document image


STEP 3 : Example of using a custom animation file

Let's create an example of how to play an animation when you click a button.

Document image


STEP 3-1 : Setting the UI

  • Add Hierachy > UI > Button.

    Document image
    

    

STEP 3-2 : Writing a script

  1. Create a Hierarchy > Create Empty Object and rename it to CharacterController.
  2. Create Project > Create > ZEPETO > TypeScript and rename it to CharacterController.
  3. Write a sample script as follows:
TypeScript

  • The flow of the script is as follows:
    • Start()
      • Adds a listener to playCustomAnimationButton that play animation when clicked.
      • Calls the ZepetoPlayers.instance.CreatePlayerWithUserId() function to create a local player.
      • Get the animator component of the local player and stores it in the localPlayerAnimator variable.

4. Attach the CharacterController script to the CharacterController object.

5. Assign Custom Animation Clip, Play Custom Animation Button from the inspector.

  • Assign an animation clip that is set to Custom Animation Clip.
  • Drag and assign the button to the Play Custom Animation Button.

    Document image
    

    

6. Play and click the button to play the animation.

👍 If you use a custom character other than a ZEPETO character,

you can apply the ZEPETO animation if it is a humanoid character.