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

이것은 FPS/TPS 제어 설정의 예입니다.




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

# 1단계 : 카메라 위치 고정

TPS에서 카메라를 고정하려면 ZepetoPlayers > ZepetoCamera > Zoom으로 이동하여 최소 및 최대 값을 동일하게 설정합니다.

Look Offset Y 값을 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"}

FPS에서 카메라를 고정하려면 ZepetoPlayers > ZepetoCamera > Zoom으로 이동하여 최소 및 최대 값을 -1로 설정합니다.

Y 오프셋 값을 0.1로 설정합니다.




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

# 2단계 : 스크립팅

카메라의 회전을 캐릭터의 회전에 적용하는 스크립트를 추가합니다.

카메라 회전 입력(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()}`);
                // 카메라의 회전은 캐릭터의 회전에 따라 수정됩니다.
                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);
        // 캐릭터의 회전을 카메라의 전방 방향과 일치시킵니다.
        this.myCharacter.gameObject.transform.rotation = Quaternion.Euler(projRot);
    }
}
```

