x


first person controller script

hi i am new to unity and now i feel that i have got to grips with the interface i want to learn how to script, i have decided to start with making a simple first person controller that can look around with the mouse and jump e.c.t but i have tried looking on the internet and i have found that there are hardly no tutorials to show me how to. can somebody please post a simple script or a link to a tutorial that i will be able to understand thanks in advance.

more ▼

asked Mar 07, 2010 at 01:42 AM

tatty gravatar image

tatty
69 25 18 25

You know the CharacterController is one of the default assets, right?

and you can find a mouselook script somewhere without trying too hard.

Mar 07, 2010 at 02:10 AM Kiloblargh
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

OK. Make a new GameObject. Add a CharacterController from Components>Physics, then a FPSWalker from Components>Scripts. Then attach a Mouse Look script from Components>Scripts>Camera Control to your Main Camera, and attach the Main Camera to the GameObject you made. Then read the scripts and figure out what they do.

more ▼

answered Mar 07, 2010 at 02:30 AM

Kiloblargh gravatar image

Kiloblargh
5k 194 173 198

(comments are locked)
10|3000 characters needed characters left

In Unity 4.5.3f3, a FPS controller and mouse look script is already available. First, you need to Import Package Character Controller

From the MouseLook.cs script:

To make an FPS style character:

  • Create a capsule.
  • Add the MouseLook script to the capsule (Component -> Camera-Control -> Mouse Look)
  • Set the mouse look to use LookX. (You want to only turn character but not tilt it)
  • Add FPSInputController script to the capsule (Component -> Character -> FPS Input Controller )
  • A CharacterMotor and a CharacterController component will be automatically added.
  • Create a camera (GameObject -> Create Other -> Camera).
  • Make the camera a child of the capsule. Reset it's transform.
  • Add a MouseLook script to the camera.
  • Set the mouse look to use LookY. (You want the camera to tilt up and down like a head. The character already turns.)
more ▼

answered Sep 01 at 05:51 AM

Akusan gravatar image

Akusan
0

(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:

x9278

asked: Mar 07, 2010 at 01:42 AM

Seen: 9639 times

Last Updated: Sep 01 at 05:51 AM