Coder Social home page Coder Social logo

dyrdadev / first-person-controller-for-unity Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 5.0 16.41 MB

A First-Person Controller for Unity.

License: MIT License

C# 100.00%
first-person first-person-game first-person-controller first-person-view game indiegame gamedev indiedev unity3d madewithunity

first-person-controller-for-unity's Introduction







First-Person Controller
for Unity






First-Person Controller for Unity

A First-Person Controller for Unity.

πŸ§ͺ EXPERIMENTAL This project is experimental. It is still under development, so it may be unstable. It is not optimized and is largely untested. Do not use this project in critical projects.

This package includes a First-Person Controller for Unity. Check out the Features section for a detailed list of all features of the controller. The footage below shows the open-source sample project "Mapper's Peak" using the First-Person Controller.



Gameplay footage from the 'Mapper's Peak' sample project using the First-Person Controller

Quick Start

  1. Install the First Person Controller: Install this package as described below.
  2. Install UniRx: The package depends on UniRx. Unfortunately, this dependency cannot be included automatically; the reason is described below in the "Special Dependencies" section. You have to include UniRx in your project. UniRx is available as UPM package or you can import it from the Asset Store.
  3. Update to Unity's new Input System This package uses Unity's Input System package. When asked from Unity, update to Unity's new Input System. Alternatively, you can implement your own FirstPersonControllerInput class and ignore the existing PlayerInput folder.
  4. Explore your scene: Add the "FirstPersonPlayer" prefab from the package to your scene. Now you can explore your scene with the First-Person Controller.

Install the Package

I recommend installing this package from a Git URL using the Package Manager window. This involves the following steps:

  1. Open the Package Manager window in your Unity editor (Window ➜ Package Manager)
  2. Click "+" in the upper left corner ➜ "Add package from git URL"
  3. Enter the Git URL of the latest release: https://github.com/dyrdadev/first-person-controller-for-unity.git#0.0.4 and click "Add"

You can find more information here.

Special Dependencies

UniRx

The controller depends on UniRx. UniRx is the implementation of ReactiveX for Unity. Unfortunately, it is not possible to add it as a dependency because Unity doesn’t support Git URLs for indirect dependencies. UniRx has to be installed manually in your project that uses the First Person Controller. UniRx is available as UPM package or you can import it from the Asset Store.

If you want to learn UniRx to extend the controller or use it for other components, I recommend the tutorial series "ReactiveX and Unity3D" by Tyler Coles. Also check out the official material of UniRx and ReactiveX.

Input System Package

The project includes player input and uses Unity's new Input System Package. The new system replaces the classic input system with the Input Manager in UnityEngine.Input. On import, Unity asks you if your project should be updated to the new Input System. If you need the UnityEngine.Input input system, you can set the "Active Input Handling" option in the Player settings (Project Settings ➜ Player ➜ Other Settings) to Both. Then you can use the new Input System Package System and the old Input Manager with the UnityEngine.Input class.

If you do not want to switch to the new input system, you can implement your own FirstPersonControllerInput class that uses the input system of your choice.

Features

Support of Various Input Devices

The First-Person Controller supports a mouse + keyboard input scheme and a gamepad input scheme. You can edit the input schemes and add new ones in the "FirstPersonInputAction" Input Action Asset. Check out the manual of the Input System for further information.

Full Locomotion

The First-Person Controller implements physics-based locomotion allowing you to move around, run, and jump.

Character Effects

The controller implements an ICharacterSignals interface for character effects such as character audio or camera effects. The interface offers you an easy way to implement your own effects. The package currently includes the following effects, which are already implemented:

  • Head Bob The package includes an optional head-bob effect for walking and running. The effect moves the camera slightly up and down to simulate the movement.
  • Sound Effects The package includes an optional component for sound effects of the character.

License

This package is licensed under an MIT license. See the LICENSE file for details.

Special Thanks

This project was inspired by the tutorial series "ReactiveX and Unity3D" by Tyler Coles. Many approaches of this tutorial series inspired features of this project. And the tutorial is what introduced me to Reactive Programming in Unity in the first place. I recommend checking out the tutorial series.

Support & Contribute

This project was created by Daniel Dyrda.

Daniel: If you want to support me and my projects, you can follow me on GitHub (dyrdadev) and Mastodon. Just come by and say hello, I would love to hear how you are using the project.

If you want to contribute to this project, you are welcome to do so. Just write to me and we will find a way to collaborate.

first-person-controller-for-unity's People

Contributors

dyrdadev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

first-person-controller-for-unity's Issues

Fix ClampRotation

Check for rotations >360. Currently it is possible to jump between upper and lower threshold.

Sensitivity param doesnt exist

When I import the package I don't find where I can change the sensitivity. When I try to turn around, I can't do it because the standard sensitivity is very low. Where can I find the sensitivity setting?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.