GithubHelp home page GithubHelp logo

gtroubley / simple-first-person-controller Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 26 KB

A simple first person controller using Unity's new input system & build-in CharacterController.

License: MIT License

C# 100.00%
first-person-controller unity

simple-first-person-controller's Introduction

Simple First Person Controller for Unity - FPController

A simple first person controller using Unity's new input system & build-in CharacterController. The controller can move, sprint, jump, handle slopes & stairs, full-no-limited air control, camera headbob and footsteps.

Getting Started

The ready for use gameObject prefabs can be found inder the folder: GameObjects/... (FPController-Builtin & FPController-URP).

Input actions can be found at Input/PlayerInputControls.

Before using the prefab, make sure to create a "Player" layer and assign it to the controller prefab and it's children.

Script Components

  • FPInputManager: Provides input.
  • FPController: Is the main script responsible for the player movement, gravity, slope handling & camera rotation.
  • FPJumping: This component enables jumping.
  • FPSprint: This component enables sprinting.
  • FPHeadbobbing: Can move the camera holder gameObject on Y-axis.
  • FPFootsteps: Responsible to play movement sounds.
  • CameraShake: Script attached to the camera gameObject, can shake the camera.

Notes

  • This first person controller uses the Unity's new input system.

Some Examples

Example to add camera shake using the static method Shake(duration,strength):

CameraShake.Shake(0.5f, 0.15f);

Special Thanks

This controller was inspired by passivestar

simple-first-person-controller's People

Contributors

gtroubley avatar

Stargazers

 avatar

Watchers

 avatar

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.