Camera question: Holding a key down and dragging?

Hi all, I’m new to Unity and I have a question about mouse input and the camera. I managed to figure out how to zoom the camera in and out with the mouse wheel already (so I was feeling pretty good), but now I’ve run into a bit of a wall :frowning:

This shouldn’t be too hard for you guys I hope:

What I want to do is to be able to rotate the camera around my character by holding down the mouse wheel button (middle mouse button) and then dragging with the mouse. And when I let go of the middle mouse button I want the camera to revert to it’s default position.

I want it this way as dragging with the mouse alone has a different function, I have that set-up as a cross-hair that’s used for clicking on items and so on. So I need the inputs to change when the middle mouse key is held down. Any help on this?

Thanks for any suggestions :smile:

No one? D:

simply check the mousebutton you want, then drag like you want, if finished call a function like this one:

function resetDrag()
{
  rotationX = 0;
  rotationY = 0;
}

I hope to understand u right

Hmm okay, I’ll have to play with that. Scripting is still a bunch of nonsensical mess to me :stuck_out_tongue:

Thanks a lot for the help :smile: