I am developing a game and I am moving my Main Camera using GUI buttons(GUI.Button()) on the iPhone screen. Whenever I press the button and release it, the camera starts moving and do not stops.
I am using rigidbody.AddForce for moving my camera.
I wish my camera to move when the button is in pressed down state, and when I release the button then I wish my camera to stop instantly.
If you are using a rigidbody without gravity, drag, etc, then adding a force will make an object fly off and never stop. You can make a rigidbody stop sharply by setting its velocity to zero - you could do this when the button is released. However, you might find that the physics engine is not the best way to handle this task. You could also try using transform.Translate to move the camera only when the button is pressed down.
Yeah, I had initially added the Character Controller. But felt it was too heavy for what I wanted to implement - Just 4 buttons to move/rotate the camera. I had no use for the keyboard or mouse(I just needed it for the buttons).
That is exactly what I tried implementing, until it became kinda complex because I was working with a Character Controller and wrote a separate code for camera with translate and then kinda messed up both. It seemed easy, but after looking through the lines, I lost track of where I was.
I have decided to start afresh tomorrow. This is what I intend to do, add a Character Control and use the CharacterController.Move() or CharacterController.SimpleMove() for the movement and use transform.rotate() for rotating the cameras.