FPS Player Controller - Glaas/SebEssentials GitHub Wiki

FPS Player Controller

Setup

Important ! For the script to function properly, you need to have a camera as a child of your Player gameObject, with its Transform reset.

Camera as a child of your object.

To setup the script, simply go on your Player gameObject, select "Add Component", type "FPS" and you should see the "FPSController" appear. The character uses the Character Controller component by Unity, which will automatically get added if not present on the same object.

Properties

Speed

  • Walking speed : Velocity when the character is not moving.
  • Running speed : Velocity when the character is running.

Jump

  • Jump force : Amount of velocity that will be added on the Y+ axis when the jump button is pressed.
  • Gravity : Amount of velocity on the Y- axis each frame, emulating gravity.

Camera

  • Look sensitivity : Speed of the camera rotation, relative to mouse movement.
  • X Clamping : In degrees, how far can the camera rotation go on the X axis. (In that case, up and down, since it's rotation.) A value of 45 is recommended.

Control keys

  • Run : Bindable key that needs to be held for the character to run.
  • Jump : : Bindable key that needs to be held for the character to jump.