Studio GuideWorld SDK Guide
Log In

ZEPETO.Character.Controller API

Class : ZepetoPlayers

  • Overview
    • To control ZepetoPlayers, add the following import statement to the script.
import {ZepetoPlayers} from 'ZEPETO.Character.Controller';

- Properties -

OnAddedLocalPlayer

  • OnAddedLocalPlayer: UnityEngine_Events.UnityEvent;RotateCamera($delta: UnityEngine.Vector2):void;
  • Callback Event invoked when a local player instance is created.

OnAddedPlayer

  • OnAddedPlayer: UnityEngine_Events.UnityEvent$1;
  • Callback Event invoked when a player instance is created.

OnRemovedPlayer

  • OnRemovedPlayer: UnityEngine_Events.UnityEvent$1;
  • Callback Event invoked when a player instance is removed.

onInitialized

  • static onInitialized;
  • Callback Event invoked when the ZepetoPlayers component is initialized at runtime.

- Accessors -

LocalPlayer

  • Represents the LocalPlayer class.
  • get LocalPlayer(): LocalPlayer;

ZepetoCamera

  • Represents the ZepetoCamera class.
  • get ZepetoCamera(): ZepetoCamera;

instance

  • Represents the instance of ZepetoPlayers.
  • static get instance(): ZepetoPlayers;

- Methods -

CreateByZepetoId()

  • CreateByZepetoId(zepetoId: string, spawnInfo: SpawnInfo, complete: System.Action$1)
  • Creates a ZEPETO character instance using a ZepetoId, mainly used for NPC character instantiation.

CreateByUserId()

  • CreateByUserId(userId: string, spawnInfo: SpawnInfo, complete: System.Action$1
  • Creates a ZEPETO character instance using a UserId, mainly used for NPC character instantiation.

RemoveCharacter()

  • RemoveCharacter(character: ZepetoCharacter)
  • Removes a character instance.

CreateModelByZepetoId()

  • CreateModelByZepetoId(zepetoId: string, spawnInfo: SpawnInfo, complete: System.Action$1<UnityEngine.GameObject>)
  • Creates a ZEPETO character model game object using a ZepetoId. Use Object.Destroy() for removal.

CreateModelByUserId()

  • CreateModelByUserId(userId: string, spawnInfo: SpawnInfo, complete: System.Action$1<UnityEngine.GameObject>)
  • Creates a ZEPETO character model game object using a UserId. Use Object.Destroy() for removal.

RemovePlayer()

  • Removelayer($id: string):void;
  • Removes the player instance associated with the specified session ID.
  • Parameters
NameValueDesc
idstringSessionID

HasPlayer()

  • HasPlayer($id: string):boolean;

  • Checks if a player instance associated with the specified session ID exists.

  • Parameters

    NameValueDesc
    idstringSessionID

GetPlayer()

  • GetPlayer($id: string):ZepetoPlayer;
  • Retrieves the player instance associated with the specified session ID.
  • Parameters
NameValueDesc
idstringSessionID
  • Returns
    • ZepetoPlayer

DeformDefaultCostume()

  • DeformDefaultCostume():void;
  • Removes the ZEPETO character's body deformation item and reverts to the default body shape, dressing in the default ZEPETO outfit.

DeformDefaultProperties()

  • DeformDefaultProperties():void;
  • Removes the ZEPETO character's body deformation item and reverts to the default body shape.

Class : SpawnInfo

  • Overview
    • Data specifying the location where a ZEPETO character is spawned.
    • To control SpawnInfo, add the following import statement to your script.
import { SpawnInfo } from 'ZEPETO.Character.Controller';
  • Parameters
NameValueDesc
positionUnityEngine.Vector3Data specifying the location where a ZEPETO character is spawned.
rotationUnityEngine.QuaternionData specifying the rotation applied when a ZEPETO character is spawned.

Class : ZepetoPlayer

  • Overview
    • To control ZepetoPlayer, add the following import statement to your script.
import {ZepetoPlayer} from 'ZEPETO.Character.Controller';

- Accessors -

userId

  • get userId(): string;
  • The player's UserID. A unique randomized ID assigned upon account creation.

name

  • get userId(): string;
  • The player's name. A name directly set by the user in the ZEPETO app.

character

  • get character(): ZepetoCharacter;
  • Represents the Zepeto character class of the player.

isLocalPlayer

  • get isLocalPlayer(): boolean;
  • A variable to check if it's a local player.

- Methods -

GetProfileTextureAsync()

  • GetProfileTextureAsync($complete: System.Action$1<UnityEngine.Texture2D>):void;
  • A method to retrieve the profile image as a 2D texture.

Release()

  • Release():void;
  • A method to release the Zepeto player object from memory.

Class : Local Player

  • Overview
    • To control LocalPlayer, add the following import statement to your script.
    import { LocalPlayer} from 'ZEPETO.Character.Controller;
    

- Properties -

movingAxis

  • movingAxis: UnityEngine.Transform;
  • Transform information of the character's movement central axis.

- Accessors -

zepetoCamera

  • Represents the Zepeto camera class.
  • get zepetoCamera(): ZepetoCamera;

zepetoPlayer

  • Represents the Zepeto player class.
  • get zepetoPlayer(): ZepetoPlayer;

- Methods -

DoubleJump()

  • DoubleJump():void;
  • Makes the Local Player double jump using the currently set DoubleJump Power.

Jump()

  • Jump():void;
  • Makes the Local Player jump using the currently set Jump Power.

Move()

  • Move($dir: UnityEngine.Vector2):void;
  • Move($dir: UnityEngine.Vector3):void;
  • Moves the Local Player in a specified direction.

SetCostume()

  • SetCostume($itemCode: string, $complete?: System.Action):void;
  • Changes the costume of the Local Player by taking the item code (item id) as an argument. A callback is received when the costume change is completed.

StopMoving()

  • StopMoving():void;
  • Stops the movement of the Local Player.

Class : ZepetoCharacter

  • Overview

    • To control ZepetoCharacter, add the following import statement to your script.
    import { ZepetoCharacter } from 'ZEPETO.Character.Controller';
    

- Properties -

OnChangedState

  • OnChangedState: UnityEngine_Events.UnityEvent$2<CharacterState, CharacterState>;
  • Called in sequence as currentState, previousState when the CharacterState of the ZepetoCharacter StateMachine changes.

OnUpdateState

  • OnUpdateState: UnityEngine_Events.UnityEvent$1;
  • Called when the CharacterState of the ZepetoCharacter StateMachine is in an Active state.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script'
import {LocalPlayer, ZepetoCharacter, ZepetoPlayers} from "ZEPETO.Character.Controller";
 
export default class CharacterTest extends ZepetoScriptBehaviour {
 
    private _zepetoCharacter: ZepetoCharacter;
 
    Start() {
        ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
            this._zepetoCharacter = ZepetoPlayers.instance.LocalPlayer.zepetoPlayer.character;
            this._zepetoCharacter.OnChangedState.AddListener((current, prev)=> {
                console.log(`OnChangedState : [${prev}] -> [{${current}]`);
            });
 
            this._zepetoCharacter.OnUpdateState.AddListener((state)=> {
                console.log(`OnUpdatedState : [${state}]`);
            });
        });
    }
}

additionalJumpPower

  • additionalJumpPower: number;
  • Represents the additional jump power value to be assigned.

additionalRunSpeed

  • additionalRunSpeed: number;
  • Represents the additional run speed value to be assigned.

additionalWalkSpeed

  • additionalWalkSpeed: number;
  • Represents the additional walk speed value to be assigned.

constraintRotation

  • constraintRotation: boolean;
  • A boolean indicating if the character's rotation is restricted.

loadedCharacter

  • Called when a ZepetoCharacter instance has finished loading.

- Accessors -

Context

  • get Context(): Zepeto.ZepetoContext;

CurrentState

  • get CurrentState(): CharacterState;

CurrentStateStatus

  • get CurrentStateStatus(): StateStatus;

ElapsedTime

  • get ElapsedTime(): number;

JumpPower

  • get JumpPower(): number;

RunSpeed

  • get RunSpeed(): number;

StateMachine

  • get StateMachine(): CharacterStateMachine;

WalkSpeed

  • get WalkSpeed(): number;

ZepetoAnimator

  • get ZepetoAnimator(): UnityEngine.Animator;

baseJumpPower

  • get baseJumpPower(): number;

baseRunSpeed

  • get baseRunSpeed(): number;

baseWalkSpeed

  • get baseWalkSpeed(): number;

characterController

  • get characterController(): UnityEngine.CharacterController;

loadingStatus

  • get loadingStatus(): ZEPETO_Character_Controller_ZepetoCharacter.LoadingStatus;

motionState

  • get motionState(): MotionState;

tryDoubleJump

  • get tryDoubleJump(): boolean;

tryJump

  • get tryJump(): boolean;

tryMove

  • get tryMove(): boolean;

- Methods -

CancelGesture()

  • CancelGesture():void;
  • Stops the playback of the animation clip playing via SetGesture.

ChangeStateAnimation()

  • ChangeStateAnimation($state: CharacterState, $moveState: CharacterMoveState):void;
  • ChangeStateAnimation($state: CharacterState, $jumpState: CharacterJumpState):void;
  • ChangeStateAnimation($state: CharacterState, $landingState: CharacterLandingState):void;
  • Changes to the specified state.

DeformDefaultProperties()

  • DeformDefaultProperties():void;
  • Resets the ZEPETO character's shape deformation items and changes to its default shape.

DeformDefaultCostume()

  • DeformDefaultCostume():void;
  • Resets the ZEPETO character's shape deformation items, changes to its default shape, and dresses it in the default ZEPETO costume.

DoubleJump()

  • DoubleJump():void;
  • Makes the character double jump with the currently set DoubleJump

GetBodyModifierProperties()

  • GetBodyModifierProperties():Zepeto.ZepetoPropertyFlag[];
  • If the ZEPETO character is wearing body deformation items, this returns information about which parts are being worn.

GetSocket()

  • GetSocket($socket: KnowSockets):UnityEngine.Transform;
  • GetSocket($socket: string):UnityEngine.Transform;
  • Retrieves the transform of a specific part of the character.

Jump()

  • Jump():void;
  • Makes the character jump with the currently set Jump Power.

Move()

  • Move($dir: UnityEngine.Vector2):void;
  • Move($dir: UnityEngine.Vector3):void;
  • Moves the character in a specified direction.

MoveContinuously()

  • MoveContinuously($dir: UnityEngine.Vector2):void;
  • MoveContinuously($dir: UnityEngine.Vector3):void;
  • Continuously moves the character in the direction it is facing (on update).

MoveToPosition()

  • MoveToPosition($pos: UnityEngine.Vector3):void;
  • Moves the character to a specified position.

Release()

  • Release():void;
  • Releases the Zepeto character object from memory.

SetGesture()

  • SetGesture($gesture: UnityEngine.AnimationClip):void;
  • Plays the character's motion for the specified AnimationClip.

StopMoving()

  • StopMoving():void;
  • Stops the character's movement.

SyncStateAnimation()

  • SyncStateAnimation():void;
  • Ensures that the ZepetoCharacter plays the animationClip for its current CharacterState. Used for synchronization purposes.

Teleport()

  • Teleport($pos: UnityEngine.Vector3, $rot: UnityEngine.Quaternion):void;
  • Instantly moves the character to the specified transform.

Class : ZEPETOCameraControl

  • Overview
    • To control ZepetoCameraControl, add the following import statement to your script.
    import { ZepetoCameraControl } from 'ZEPETO.Character.Controller;
    

- Accessors -

Enable

  • set Enable(value: boolean);
  • Determines whether camera control (zoom or rotation) input is enabled.

Class : CharacterStateMachine

  • Overview
    • To control CharacterStateMachine, add the following import statement to your script.
    import { CharacterStateMachine } from 'ZEPETO.Character.Controller;
    

- Accessors -

constraintStateAnimation

  • set constraintStateAnimation(value: boolean);
  • Enables or disables the transition of animations being played in the CharacterStateMachine based on the CharacterState.

- Methods -

ChangeStateAnimation()

  • ChangeStateAnimation($state: CharacterState):void;
  • Makes the ZepetoCharacter play the animationClip corresponding to the provided state.

SyncStateAnimation()

  • SyncStateAnimation():void;
  • Ensures that the ZepetoCharacter plays the animationClip for its current CharacterState. Used for synchronization purposes.

Class : CharacterShadow

  • Overview
    • To control CharacterShadow, add the following import statement to your script.
    import { CharacterShadow } from 'ZEPETO.Character.Controller;
    

- Properties -

target

  • public target: UnityEngine.Transform;
  • Represents the object that serves as the reference for adjusting the CharacterShadow's transform.

autoSyncTransform

  • public autoSyncTransform: boolean;
  • A flag indicating whether to correct the shadow's position.

Class : MotionState

- Accessors -

CurrentJumpState

  • get CurrentJumpState(): ZEPETO_Character_Controller.CharacterJumpState;
  • Returns the current jump state of the character.

CurrentLandingState

  • get CurrentLandingState(): ZEPETO_Character_Controller.CharacterLandingState;
  • Returns the current landing state of the character.

CurrentMoveState

  • public get CurrentMoveState(): ZEPETO_Character_Controller.CharacterMoveState;
  • Returns the current movement state of the character.

Gravity

  • get Gravity(): number;
  • set Gravity(value: number);
  • Gets or sets the character's gravity value.

doubleJumpPower

  • get doubleJumpPower(): number;
  • set doubleJumpPower(value: number);
  • Gets or sets the character's double jump power.

landingRollSpeed

  • get landingRollSpeed(): number;
  • set landingRollSpeed(value: number);
  • Gets or sets the character's landing roll speed.

useDoubleJump

  • get useDoubleJump(): boolean;
  • set useDoubleJump(value: boolean);
  • Gets or sets whether the character can use double jump.

useLanding

  • public get useLanding(): boolean;
  • public set useLanding(value: boolean);
  • Gets or sets whether the character uses landing.

useLandingRoll

  • public get useLandingRoll(): boolean;
  • public set useLandingRoll(value: boolean);
  • Gets or sets whether the character uses landing roll.

useMoveTurn

  • public get useMoveTurn(): boolean;
  • public set useMoveTurn(value: boolean);
  • Gets or sets whether the character uses move turn.

Class : ZepetoCamera

  • Overview
    • To control ZepetoCamera, add the following import statement to the script.
import { ZepetoCamera } from 'ZEPETO.Character.Controller';

- Properties -

OnChangedState

  • OnChangedState: UnityEvent$2<CameraState, CameraState>
  • It is called sequentially with currentState, previousState when CameraState changes.

OnUpdateState

  • OnUpdateState: UnityEvent$1
  • It is called when CameraState is in the Active state.

additionalMaxZoomDistance

  • additionalMaxZoomDistance: number
  • Maximum zoom value to be additionally assigned.

additionalMinZoomDistance

  • additionalMinZoomDistance: number
  • Minimum zoom value to be additionally assigned.

additionalOffset

  • additionalOffset: Vector3
  • Offset value to be additionally assigned.

- Accessors -

CollisionLayer

  • get CollisionLayer(): LayerMask​
  • set CollisionLayer(value): void
  • You can get and set the Layer to apply the camera collision. However, Layers set as the Player Layer are not applied.
    • Parameters
NameType
valueLayerMask

FollowTarget

  • get FollowTarget(): Transform
  • The transform of the target the camera will follow. By default, it focuses on the HEAD_UPPER of the local player, and continues to follow during camera/character movement.

LockXAxis

  • get LockXAxis(): boolean
  • set LockXAxis(value): void
  • (Vertical direction) Whether Rotation is locked or not
    • Parameters
NameType
valueLayerMask

LookOffset

  • get LookOffset(): Vector3
    • Standard location for Camera Focusing (based on Character Head)

MaxZoomDistance

  • get MaxZoomDistance(): number
  • Zoom Out Maximum Range

MinZoomDistance

  • get MinZoomDistance(): number
  • Zoom In Maximum Range

StateMachine

  • get StateMachine(): StateMachine$1
  • Returns the StateMachine object of ZepetoCamera

camera

  • get camera(): Camera
  • Camera object

cameraParent

  • get cameraParent(): Transform
  • Transform of the camera parent object

currentState​

  • get currentState(): CameraState
  • Current CameraState

currentStateStatus​

  • get currentStateStatus(): StateStatus
  • Current CameraStateStatus

distance​

  • get distance(): number
  • Distance from the target

isFollow​

  • get isFollow(): boolean
  • Whether following the target or not

position​

  • get position(): Vector3
  • Current camera position value

rotation​

  • get rotation(): Quaternion
  • Current camera rotation value

- Methods -

DoZoom​

  • DoZoom($delta): void
  • Zoom by the parameter value
    • Parameters​
NameType
$deltanumber

Release​

  • Release(): void
  • Release memory when the camera is no longer in use

Rotate​

  • Rotate($delta): void
  • Rotate by the parameter value
    • Parameters​
NameType
$deltaVector2

SetFollowTarget​

  • SetFollowTarget($target, $scaleReference?): void
  • Set whether to follow the target or not
    • Parameters​
NameType
$targetTransform
$scaleReference?Transform

Create​

  • Static Create($camera, $data): ZepetoCamera

  • Create a camera

    • Parameters​

      NameType
      $cameraCamera
      $dataCameraData

Enumeration

CharacterState

  • Invalid = 0, Idle = 1, Walk = 2, Run = 3, JumpIdle = 4, JumpMove = 5, Teleport = 20, Gesture = 30, Move = 102, MoveTurn = 103, Jump = 104, Stamp = 106, Falling = 108, Landing = 109

CharacterMoveState

  • None = -1, MoveWalk = 0, MoveRun = 1

CharacterJumpState

  • None = -1, JumpIdle = 0, JumpMove = 1, JumpDash = 2, JumpDouble = 3

CharacterLandingState

  • None = -1, LandingSlight = 0, LandingDeep = 1, LandingRoll = 2

KnowSockets

  • HEAD_UPPER = 0

CameraState

  • Idle = 0, Follow = 1

StateStatus

  • Wait = 0, Enter = 1, Update = 2, End = 3, Leave = 4