Newer
Older
# FPSControl
These two Scripts allow you to implement a simple First-Person Control for Unity.
This enables the player to change position by walking, running and jumping by pressing the following keys:
- <kbd>W</kbd> or <kbd>↑</kbd> Moves forwards
- <kbd>A</kbd> or <kbd>←</kbd> Moves sidways to the left
- <kbd>S</kbd> or <kbd>↓</kbd> Moves backwards
- <kbd>D</kbd> or <kbd>→</kbd> Moves sidways to the right
### Script 2: SmoothMouseLook
This allows users to use the mouse for looking around, with seperate sensitivites for Left/Right and Up/Down directions.
## Setup

1. Add a Empty with <kbd>Rightclick</kbd> + `Add Empty`. Rename it to something useful (we used `Player`)
2. Make sure the `Main Camera` is at the coordinates `(0, 1.7, 0)` and rotated right and then drag the `Main Camera` onto the `Player`-Empty. This makes `Player` the parent of `Main Camera`
3. Create a Capsule that represents the Player-Body (for collisions and such) with <kbd>Rightclick</kbd> + `3D Object` > `Capsule`. Drag it onto the `Player`-Empty as well.
Now things should look like in the picture above (highlighted in blue). Next we can add the Scripts.
1. Drag the `Movement.cs`-script from the Assets onto the `Player`-Empty
2. Drag the `SmoothMouseLook.cs`-script from the Assets onto the `Player`-Empty.
## Tweaking
- Adjust the relative positions and sizes of `Player`, `Capsule` and `Main Camera` to change the height of the character and the way rotating the view feels.
- Adjust the parameters of the scripts
- Adjust the FOV of the Camera to make it more wide angle or narrow the view down