Hello World =)
I’m working on an architecture Project, and we need to change the way to direct ourselves. The camera have to rotate only when you old the left click of your mousse!
I try something on the MouseLook.cs (which was given by Unity), but that’s not fluid at all!
here my code!
void Update ()
{
//Only when you old the Mousse
if (Input.GetMouseButton(0)){
if (axes == RotationAxes.MouseXAndY)
{
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX * Time.deltaTime;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY * Time.deltaTime;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
}
else if (axes == RotationAxes.MouseX)
{
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
}
else
{
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
}
}}
Hope you can help me!