Camera Rotate Arrow Keys

Hi guys, I’ve been looking around a little for a camera that i can use, a script really, just looking for some advice.
What I want is a camera that follows the main character, as in the character stats in the middle of the frame.
I want to be able to rotate the camera around the character using only the arrow keys. Left and right for example, not too worried about up and down, maybe to a slight degree.
The camera should be able to move at player choice, so I don’t want it to follow behind the character at all, I should also note I will be doing click to move.
I suppose the best example for exact what I want is RuneScape.
I think being able to modify the 3rd person script the engine comes with should be simple enough, but I have no experience in camera.
Direction or help would be great, thanks. :slight_smile:

Look at the MouseOrbit.js camera script in the standard assets as a starting point. You just need to change the inputs from horizontal mouse axis to button press, and remove the vertical mouse axis influence.

I’m having issues trying to figure it out, I’m looking at the script (I finally found it, thanks for the name) but I’m not exactly sure what to be changing, i changed a few things but it…It doesn’t work :confused: ((Old))

Actually I figured the movement out, but it just spins in circles, I have no idea how to fix that, easy I’m really sure but I’ll look into it more tomorrow. Any light anyone could shed though would be great.

You’ll need to provide a little more detail than “i changed a few things,” and “It doesn’t work,” for anyone to be able to offer much help… :wink:

What I mean is, obviously I’m not sure what I’m doing but I changed the script and mapped new keys so I can use them, this is what I changed.

function LateUpdate () {
    if (target) {
        x += Input.GetAxis("Right") * xSpeed * 0.02;
        y -= Input.GetAxis("Up") * ySpeed * 0.02;
 		
 		y = ClampAngle(y, yMinLimit, yMaxLimit);
 		       
        var rotation = Quaternion.Euler(y, x, 0);
        var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;

“Right” and “up” are the arrow keys I put in instead of the mouse, but if I hit it once it will keep spinning without stopping.
I think the answer lays in the code but I am not sure. :slight_smile: