Hi everyone.
So, i ve got this script in C#:
using UnityEngine;
using System.Collections;
public class MouseLook3 : MonoBehaviour {
public float sensitivityX = 15F;
public float minimumX = -60F;
public float maximumX = 60F;
float rotationX = 0F;
Quaternion originalRotation;
void Update ()
{
rotationX += Input.GetAxis(“Mouse X”) * sensitivityX;
rotationX = ClampAngle (rotationX, minimumX, maximumX);
Quaternion xQuaternion = Quaternion.AngleAxis (rotationX, Vector3.left);
transform.localRotation = originalRotation * xQuaternion;
}
void Start ()
{
if (rigidbody)
rigidbody.freezeRotation = true;
originalRotation = transform.localRotation;
}
public static float ClampAngle (float angle, float min, float max)
{
if (angle < -360F)
angle += 360F;
if (angle > 360F)
angle -= 360F;
return Mathf.Clamp (angle, min, max);
}
}
BUT it follows mouse while moving it up or down. how can i modify the script so it will follow it from right to left and opposite?
Can anyone help me with this coding?
Thanks in advance