ZEPETOCharacter
ZEPETOCharacter is basic ZEPETO character instance unit for loading in a World Scene.
ZepetoCharacter API
API | Description |
---|---|
CreateByZepetoId(zepetoId: string, spawnInfo: SpawnInfo, complete: System.Action$1) | Use a ZEPETO ID to generate a ZEPETO character instance. |
CreateByUserId(userId: string, spawnInfo: SpawnInfo, complete: System.Action$1) | Create a ZEPETO character instance with UserId. |
RemoveCharacter(character: ZepetoCharacter) | Deletes the character instance. |
You can load ZEPETO character model instances, except controller components.
API | Description |
---|---|
CreateModelByZepetoId(zepetoId: string, spawnInfo: SpawnInfo, complete: System.Action$1<UnityEngine.GameObject>) | Create a ZEPETO character instance with the ZepetoId. |
CreateModelByUserId(userId: string, spawnInfo: SpawnInfo, complete: System.Action$1<UnityEngine.GameObject>) | Create a ZEPETO character instance with UserId. |
Create/Delete Character
Create by Zepeto ID
ZepetoCharacterCreator.CreateByZepetoId("[ZEPETO_ID]", new SpawnInfo(), (character: ZepetoCharacter) => {
// Handling Character Instance..
})
Remove Character
ZepetoCharacterCreator.RemoveCharacter(character: ZepetoCharacter);
Control Character
An interface where you can directly control the character will be provided through the script from a character instance in a Scene.
API | Description |
---|---|
MoveToPosition(position : Vector3) | Moves the character to Position. |
MoveContinuously(direction : Vector3) | Updates the character in the direction of Direction continuously. |
MoveContinuously(direction : Vector2) | Updates the character in the direction of Direction continuously. |
StopMoving() | Stops the character from moving. |
Jump() | Character jumps to the Jump Power set. |
Teleport(position: UnityEngine.Vector3, rotation: UnityEngine.Quaternion) | Character instantly moves to Transform. |
SetGesture(gesture: UnityEngine.AnimationClip) | Character motion will Play as indicated in the AnimationClip. The character will continue until CancelGesture() is called. |
CancelGesture() | Stops the Animation Clip currently playing. |
Control Character example code.
// 1) MoveToPosition - Move until the character reaches the target position
character.MoveToPosition(Vector3 position);
// 2) MoveContinuosly - Move in the specified direction (In Update) until told otherwise.
character.MoveContinuously(Vector3 direction);
character.MoveContinuously(Vector2 direction);
// 3) StopMoving - Halt a currently active movement.
character.StopMoving();
// 4) Jump - Jump at the currently set up jump height
character.Jump();
// 5) Teleport - Instantly move to a specified Transform point.
character.Teleport(transform.position, transform.rotation);
Control Character - Gesture example code.
// 1) SetGesture - Play a character motion based on the specified AnimationClip on loop until CancelGesture() is called.
character.SetGesture(AnimationClip gesture);
// 2) Cancel - Stop the current AnimationClip in motion.
character.CancelGesture();
Control Character - MotionV2 example code.
// Allows adjustment of the MotionController V2 and its related parameter values.
character.MotionV2.useDoubleJump = (boolean);
character.MotionV2.doubleJumpPower = (number);
character.MotionV2.useLandingRoll = (boolean);
character.MotionV2.landingRollSpeed = (number);
character.MotionV2.useMoveTurn = (boolean);
character.MotionV2.Gravity = (number);
// You can check the SubState associated with Motion Controller V2.
character.MotionV2.CurrentJumpState();
character.MotionV2.CurrentLandingState();
character.MotionV2.CurrentMoveState();
You can turn on/off Motion V2 character State Machine Animation from World Package 1.6.0 and later version.
// The animation is no longer automatically played by the character's StateMachine.
ZepetoCharacter.StateMachine.constraintStateAnimation = true;
const stateType = UnityEngine.Animator.StringToHash("State");
ZepetoCharacter.ZepetoAnimator.SetInteger(stateType, "[Custom Animation State]");
Updated 3 months ago