Click, drag and rotate!

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!

By fluid I imagine you mean not as snappy? You could reduce the gravity on your MouseX and MouseY axis in the Input manager, this will make it so you need some time to speed up your camera movement.

Possibly the common Cameraorbit script, available at unitywiki, is what you are after…
Then you can put the condition of Input.GetMouseButton(0) to its action.

For fluid … in fact my camera is kind of “lagging” when i try to turn, but not when i’m going straight. but my FPS are at 150…
The gravity on the mouse did not change any thing, i willl try the second one : i didn’t know the existence of the orbital scirpt, i’m going to read it!

thanks!