diff --git a/README.md b/README.md index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0a0b2785e34958e7fbc54a9ede7458a2e790c51d 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,38 @@ +# 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 + + + +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 diff --git a/images/screenshot.png b/images/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..ddc700a5434dd4725062e9dc76833d68bd2c5fe7 Binary files /dev/null and b/images/screenshot.png differ