---
title: Quarter View Example
slug: world-sdk-guide/quarter-view-example
docTags: 
createdAt: 2024-09-02T08:34:13.135Z
---

ZEPETO character controls can be customized to use Unity's New Input System instead of V-Pad.

These are examples of setting the Quarter View control.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-xmQtwzWGSIx89Sk3SXoD--20240904-102421.gif)



## STEP 1 : Camera View Setting

Set the Camera as Quarter View (This is an example, so please modify the camera setting according to your project.)

At this point, the camera's tag should be set to MainCamara.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-4LZZcBKXUC_vjjaBZ0NHG-20240904-102421.png)

## STEP 2 : InputAction Setting

By defining a new InputAction for the Qiarter View, you can control character movements through touch screen.

Select Create > Input Actions and set the file name as QuarterViewActions.

- Move
  - Action Type : Pass Through
- Move Trigger
  - Action Type : Button

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-9m15KB6FImRIffLFOQJyO-20240904-102421.png)



After creating Hierarchy > Create Empty Object, change the file name to QuarterViewController.

From QuarterViewController object, select Add Component and add the Player Input.

::Image[]{src="https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-hoF1gVUhEJKbPMIEVxZVV-20240904-102421.png" size="84" width="407" height="290" position="center" showCaption="false"}



Drag and connect the QuarterView Actions that you just created to the Actions list.

Change the Behavoir to Invoke Unity Events.

![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-RDg-RfMrNca4Ctr_HbZEg-20240904-102421.png)



## STEP 3 : Scripting

Write a script that calculates the direction of the character's movement through touch screen input.

Select Create > ZEPETO > TypeScript and rename it QuarterView Controller.

Adds the script to the QuarterView Controller object.

```typescript
import {ZepetoScriptBehaviour} from 'ZEPETO.Script'
import {PlayerInput,InputAction} from "UnityEngine.InputSystem"
import {CallbackContext} from "UnityEngine.InputSystem.InputAction"
import {CharacterState, ZepetoCharacter, ZepetoPlayers, ZepetoCamera} from 'ZEPETO.Character.Controller'
import {Camera, Quaternion, Time, Vector2, Vector3, WaitForEndOfFrame} from "UnityEngine";

export default class QuarterViewController extends ZepetoScriptBehaviour {

    private myCharacter: ZepetoCharacter;
    private startPos: Vector2 = Vector2.zero;
    private curPos: Vector2 = Vector2.zero;

    private playerInput: PlayerInput;
    private touchPositionAction : InputAction;
    private touchTriggerAction : InputAction;

    private isTriggered: boolean = false;
    private isTouchDown: boolean = false;

    private CanMove() : boolean {
        return this.isTouchDown && !this.isTriggered;
    }


    OnEnable(){
        this.playerInput = this.gameObject.GetComponent<PlayerInput>();
    }

    Start() {

        this.touchTriggerAction = this.playerInput.actions.FindAction("MoveTrigger");
        this.touchPositionAction = this.playerInput.actions.FindAction("Move");

        this.touchTriggerAction.add_started((context)=>{
            this.isTriggered = true;
            this.isTouchDown = true;
        });

        this.touchTriggerAction.add_canceled((context)=>{
            this.isTriggered = false;
            this.isTouchDown = false;
        });

        this.touchPositionAction.add_performed((context)=>{
            
            if(this.isTouchDown)
            {
                this.curPos = context.ReadValueAsObject() as Vector2;

                if(this.isTriggered) {
                    this.isTriggered = false;
                    this.startPos = this.curPos;
                }
            }
        });


        ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
            ZepetoPlayers.instance.LocalPlayer.zepetoCamera.gameObject.SetActive(false);
            this.myCharacter = ZepetoPlayers.instance.LocalPlayer.zepetoPlayer.character;

            this.StartCoroutine(this.InputControlLoop());
        });
    }

    private *InputControlLoop(){
        while(true)
        {
            yield new WaitForEndOfFrame();

            if (this.myCharacter && this.CanMove()) {

                var camRot = Quaternion.Euler(0, Camera.main.transform.rotation.eulerAngles.y, 0);
                var moveDir = Vector2.op_Subtraction(this.curPos, this.startPos);
                moveDir = Vector2.op_Division(moveDir, 100);


                if (moveDir.magnitude > 0) {

                    if(moveDir.magnitude > 1)
                        moveDir.Normalize();

                    var optMoveDir = new Vector3(moveDir.x, 0, moveDir.y);
                    optMoveDir = Vector3.op_Multiply(optMoveDir, Time.deltaTime * 80 );
                    this.myCharacter.Move(camRot * optMoveDir);
                }
            }
        }
    }
}
```

