현재 이 영상 보면서 마우스 조작으로 카메라 각도를 이동하는걸 구현하고 있는데요,
using UnityEngine;
using System.Collections;
public class MouseLook : MonoBehaviour {
public float Smoothness = 4;
public Vector2 Sensitivity = new Vector2(4, 4);
private Vector2 NewCoord;
[HideInInspector]
public Vector2 CurrentCoord;
public Vector2 Limit = new Vector3(-70, 80);
private Vector2 vel;
void Update () {
NewCoord.x = Mathf.Clamp (NewCoord.x, Limit.x, Limit.y);
NewCoord.x = Input.GetAxis ("Mouse Y") * Sensitivity.x;
NewCoord.y += Input.GetAxis ("Mouse X") * Sensitivity.y;
CurrentCoord.x = Mathf.SmoothDamp(CurrentCoord.x, NewCoord.x, ref vel.x, Smoothness/100);
CurrentCoord.y = Mathf.SmoothDamp(CurrentCoord.y, NewCoord.y, ref vel.y, Smoothness/100);
transform.rotation = Quaternion.Euler (CurrentCoord.x, CurrentCoord.y, 0);
}
}
using System.Collections;
public class MouseLook : MonoBehaviour {
public float Smoothness = 4;
public Vector2 Sensitivity = new Vector2(4, 4);
private Vector2 NewCoord;
[HideInInspector]
public Vector2 CurrentCoord;
public Vector2 Limit = new Vector3(-70, 80);
private Vector2 vel;
void Update () {
NewCoord.x = Mathf.Clamp (NewCoord.x, Limit.x, Limit.y);
NewCoord.x = Input.GetAxis ("Mouse Y") * Sensitivity.x;
NewCoord.y += Input.GetAxis ("Mouse X") * Sensitivity.y;
CurrentCoord.x = Mathf.SmoothDamp(CurrentCoord.x, NewCoord.x, ref vel.x, Smoothness/100);
CurrentCoord.y = Mathf.SmoothDamp(CurrentCoord.y, NewCoord.y, ref vel.y, Smoothness/100);
transform.rotation = Quaternion.Euler (CurrentCoord.x, CurrentCoord.y, 0);
}
}
해당 스크립트를 카메라에 넣으면 좌우회전은 잘 되는데, 위아래 회전이 되지 않습니다 ..
vector2 때문인가해서 vector3로도 해봤는데 동일하네요 ..
해결 방법 좀 부탁 드립니다 ㅜ
x y z
그렇게 해봤는데도 동일해서요 ..
look 벡터의 R 벡터를 축으로 해야 위아래... 이렇게 했나여
무슨 말씀이신지 이해가 되지 않습니다 ㅜ
아무것도 아닙니다 저랑 방법이 다르네여