Unity/기능구현
유니티) 3D 캐릭터 마우스로 회전시키기
HJH0825
2018. 12. 6. 09:23
캐릭터 회전시키기 :
마우스 이동 시 큐브가 좌우로 움직임
public class PlayerMove : MonoBehaviour {
float rotSpeed = 1.0f; //ADD
// Update is called once per frame
void Update () {
// 마우스 입력
float MouseX = Input.GetAxis("Mouse X");
transform.Rotate(Vector3.up * rotSpeed * MouseX);
}
}
transform.Rotate(회전할 기준 좌표 축 * Time.deltaTime * 회전 속도 * 변위 값)
출처:http://itmining.tistory.com/48