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

These are examples of setting FPS/TPS control.




::Image[]{src="https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-SfBjO22g-SoCWm4vqWy1X-20240904-102409.gif" size="92" width="600" height="290" position="center" showCaption="false"}

# STEP 1 : Fixing Camera Position

To fix the camera in TPS, go to ZepetoPlayers > ZepetoCamera > Zoom and set the Min and Max value to same.

Set the Look Offset Y value to 0.1.




::Image[]{src="https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-WJL-wyerhl3P0GcdOfGIU-20240904-102409.png" size="78" width="682" height="436" position="center" showCaption="false"}

To fix the camera in FPS, go to ZepetoPlayers > ZepetoCamera > Zoom and set the Min and Max value to -1.

Set the Look Offset Y value to 0.1.




![](https://api.archbee.com/api/optimize/fCt3n1oCa8rgNJ8fw9I2N-wW6Zv1CkMMomrChpB6V6l-20240904-102409.png)

# STEP 2 : Scripting

Add a script that applies the rotation of the camera to the rotation of the character.

Add a script to correct the rotation of the character by receiving the camera rotate input (OnDragEvent).

```typescript
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ZepetoPlayers, ZepetoCharacter, ZepetoScreenTouchpad, ZepetoCamera } from 'ZEPETO.Character.Controller';
import { Vector3, Time, Quaternion} from 'UnityEngine';
import { ZepetoInputControl } from 'RootNamespace';

export default class TPSController extends ZepetoScriptBehaviour {

    private zepetoScreenPad: ZepetoScreenTouchpad;
    private myCharacter: ZepetoCharacter;
    private myInputControl: ZepetoInputControl;
    private myCamera: ZepetoCamera;

    Awake() {
        this.myInputControl = new ZepetoInputControl();
    }

    Start() {
        this.myInputControl.Enable();
        ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
            this.myCamera = ZepetoPlayers.instance.LocalPlayer.zepetoCamera;
            this.myCharacter = ZepetoPlayers.instance.LocalPlayer.zepetoPlayer.character;
            this.zepetoScreenPad = ZepetoPlayers.instance.gameObject.GetComponentInChildren<ZepetoScreenTouchpad>();
            this.zepetoScreenPad.OnDragEvent.AddListener(deltaVector => {
                console.log(`[OnDragEvent] : ${deltaVector.ToString()}`);
                // The rotation of the camera is corrected according to the rotation of the character.
                ZepetoPlayers.instance.ZepetoCamera.transform.RotateAround(this.myCharacter.transform.position,
                    Vector3.up, deltaVector.x * Time.deltaTime * 80);
            });
        });
    }

    Update() {
        if ((null == this.myCharacter) || (null == this.myCamera)) {
            return;
        }
        const lookAxisRot = Quaternion.LookRotation(this.myCamera.cameraParent.forward);
        const projRot = Vector3.ProjectOnPlane(lookAxisRot.eulerAngles, Vector3.right);
        // Match the rotation of the character with the forward direction of the camera.
        this.myCharacter.gameObject.transform.rotation = Quaternion.Euler(projRot);
    }
}
```

