Camera behavior the same as the unity editor has

Hi guys i want to create the same camera behavior as the scene view camera in unity.

moving with arrows on X/Z axis , rotating the camera just during holding the right mouse button and zooming with mouse wheel … any ideas ?

The moving part is done … it works perfectly , i tried just modify the MouseLook script with if (Input.GetMouseButtonDown(1)) but it doesnt work as i expected .

Hello,

I’m not going to go over the scroll wheel, since even I don’t know how that works in Unity… it changes some other camera stuff too.
Also I’m not going to go over increasing speed using shift or just moving more.
As you have already suceeded im making the mouse make the camera look, I’ll just make it move :slight_smile:

function Update() {
    //Here you have the looking, whch you already have :)
    
    //First, lets check if left mouse is down
    if (Input.GetMouseButton(1)) {
        //Now lets move according to the direction
        //first forwards and backwards
        transform.position += transform.forward*Input.GetAxis("Vertical");
        
        //then sideways
        transform.position += transform.right*Input.GetAxis("Horizontal");
    }
}

Hope this helps,
Benproductions1

FlyCam_Extended shows how to implement movement and looking. It also shows moving faster/slower.

To limit movement to right mouse click, you can wrap the changes to transform.localRotation in transform.position with if (Input.GetMouseButton(1)) (as Benproductions1 showed).

Doing middle click panning would essentially be adding rotationX/Y to transform.position inside an if (Input.GetMouseButton(2)) block.