x


How to edit the looking on the FP controller?

As you know, the default Unity FPS controller uses the mouse to look around and aim the character, and the keys to strafe and move. Instead, I would like the forward and backwards to stay the same, but the left and right arrows to rotate the character, freeing up the mouse for interaction. How would I go about this?

more ▼

asked May 20 '10 at 06:54 AM

Joe 4 gravatar image

Joe 4
11 1 1 2

Hi Joe, a question before an answer. How do you expect the vertical portion of the look to behave? Will it be controlled manually, for example by "look up" and "look down" keys? Or do you need it controlled automatically in some way.

May 20 '10 at 05:14 PM SteveFSP
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can edit the Script. Replace the original Update function with

void Update ()
{
        transform.Rotate(0, Input.GetAxis("Horizontal") * sensitivityX, 0);
}

By doing this you read the Input nor from the Mouse but instead from the Axis Horizontal which should map to the right and left key.

more ▼

answered Oct 29 '10 at 01:28 PM

lhk gravatar image

lhk
520 14 15 24

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5099
x3753
x1176
x37
x9

asked: May 20 '10 at 06:54 AM

Seen: 1601 times

Last Updated: May 20 '10 at 06:54 AM