Skip to content
Snippets Groups Projects
Commit dc49399e authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Clearer Readme

parent d1658158
No related branches found
No related tags found
No related merge requests found
# FPSControl
These two Scripts allow you to implement a simple First-Person Control for Unity.
### Script 1: FPSController
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
- <kbd>Shift</kbd> "Run" (move faster)
- <kbd>Space</kbd> Jump
### Script 2: SmoothMouseLook
This allows users to use the mouse for looking around, with seperate sensitivites for Left/Right and Up/Down directions.
## Setup
![](images/screenshot.png)
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 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 `FPSController.cs`-script from the Assets onto the `Player`-Empty
2. Drag the `SmoothMouseLook.cs`-script from the Assets onto the `Main Camera` Object. And in the Script options (right sidebar) change the value for _Character Body_ to `Player`
3. Select the `Capsule` Object
## 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
\ No newline at end of file
images/screenshot.png

45.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment