0
이것은 내 CamMouseLook 스크립트이며, 플레이어가 마우스를 완전히 위로 움직이면 거꾸로 뒤집습니다. 이 특정 축에서 회전을 잠그는 것입니다 거꾸로Unity Player Controller - 거꾸로되지 않도록 만드는 방법
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamMouseLook : MonoBehaviour {
Vector2 mouseLook;
Vector2 smoothV;
public float sensitivity = 5.0f;
public float smoothing = 2.0f;
GameObject character;
// Use this for initialization
void Start() {
character = this.transform.parent.gameObject;
}
// Update is called once per frame
void Update() {
var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
md = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f/smoothing);
smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f/smoothing);
mouseLook += smoothV;
transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);
}
}
나는 당신을 사랑합니다. thnx fam –