using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Look : MonoBehaviour
{
public enum RotationAxes
{
XandY,
X,
Y
}
public RotationAxes axes = RotationAxes.XandY;
public float sensitivityHor = 5.0f;
public float sensitivityVer = 5.0f;
private float _rotationX = 0;
void Update()
{
if (axes == RotationAxes.XandY)
{
float mouseX = Input.GetAxis("Mouse X") * sensitivityHor;
float mouseY = Input.GetAxis("Mouse Y") * sensitivityVer;
_rotationX -= mouseY;
_rotationX = Mathf.Clamp(_rotationX, -90, 90);
transform.localRotation = Quaternion.Euler(_rotationX, 0, 0);
transform.Rotate(0, mouseX, 0);
}
else if (axes == RotationAxes.X)
{
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityHor, 0);
}
else if (axes == RotationAxes.Y)
{
_rotationX -= Input.GetAxis("Mouse Y") * sensitivityVer;
_rotationX = Mathf.Clamp(_rotationX, -90, 90);
transform.localRotation = Quaternion.Euler(_rotationX, 0, 0);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Look : MonoBehaviour
{
public enum RorationAxes
{
XandY,
X,
Y
}
public RorationAxes _axes = RorationAxes.XandY;
public float _rotationSpeedHor = 5.0f;
private void update()
{
if(_axes == RorationAxes.XandY)
{
}
else if(_axes == RorationAxes.X)
{
transform.Rotate(0, _rotationSpeedHor, 0);
}
else if (_axes == RorationAxes.Y)
{
}
}
}