#1 FPS Movement: Let's Make a First Person Game in Unity!

Natty GameDev
8 Dec 202121:38

Summary

TLDRThis video marks the beginning of a series where the creator guides viewers through building a first-person game in Unity, focusing on elements like interaction, enemy AI, and dynamic music. The tutorial covers creating a custom character controller using Unity's new input system. Key topics include player movement, jump mechanics, and implementing gravity. Additional features like looking around with mouse and gamepad inputs, along with the ability to sprint and crouch, are also introduced. Viewers are encouraged to follow along and set up their own systems, with the promise of more advanced mechanics in future videos.

Takeaways

  • 😀 The video introduces a tutorial series on creating a first-person game in Unity, focusing on character control, input management, and other game development concepts.
  • 😀 Unity’s new input system is used to build a custom character controller, offering more flexibility and features compared to Unity’s built-in input manager.
  • 😀 The player character is initially set up using a capsule, with a character controller attached for physics-based movement.
  • 😀 A custom input action map for player movement is created using Unity's input system, allowing for easy customization of controls for both keyboard and gamepad.
  • 😀 The input action for movement is set up to support both WASD keys for keyboard input and left-stick input for gamepads.
  • 😀 The script for handling input actions (e.g., movement, jump) is organized with clear separation between different action types, making it easy to add new features later.
  • 😀 Player gravity is handled by adding a downward force that accumulates every frame, with checks in place to prevent excessive gravity when grounded.
  • 😀 Jumping functionality is added by modifying the player's vertical velocity, triggered by user input (spacebar or gamepad button).
  • 😀 The ability to look around is implemented by using mouse input for horizontal and vertical rotation, with adjustable sensitivity and clamping to prevent excessive rotation.
  • 😀 The tutorial encourages further exploration by adding sprinting and crouching functionality, offering an extended learning opportunity for viewers.
  • 😀 The next video will focus on creating an interaction system, expanding on the character controller's capabilities to interact with objects or environments in the game.

Q & A

  • What is the purpose of the first-person game creation series in Unity?

    -The series aims to guide the user through creating a first-person game in Unity, focusing on skills applicable to various first-person games, including interaction, enemy AI, dynamic music, post-processing, and more.

  • Why is Unity's new input system being used in this project?

    -Unity's new input system is used because it offers more flexibility and professional control schemes compared to the built-in input manager, which is useful for creating complex control systems for games.

  • How does the action map 'on foot' function in the input system?

    -The 'on foot' action map groups all the actions that a player can perform while walking around in the game. For example, it includes actions for movement and jumping while the player is on foot.

  • What is the purpose of using a '2D Vector Composite' for the movement bindings?

    -The 2D Vector Composite returns a normalized Vector 2, ranging from -1 to 1, making it ideal for directional input, such as WASD keys for movement or the left stick of a gamepad.

  • Why does the input system allow bindings for both keyboard and gamepad?

    -The input system supports bindings for both keyboard and gamepad to ensure that the game is playable across various devices. By using generic bindings like 'left stick up' or 'w' for movement, the game can support multiple control schemes.

  • How is the player movement implemented in the script?

    -Player movement is implemented by taking input from the action map, calculating the movement direction using the input values, and then applying the movement to the character controller with a specified speed.

  • What is the function of the 'player motor' script in this setup?

    -The 'player motor' script handles the player movement functionality by applying input values to the character controller, translating them into directional movement for the player character in the game world.

  • How does the gravity system work in the player movement?

    -Gravity is applied by modifying the player's velocity in the Y-axis. The 'is grounded' boolean ensures the gravity effect is only active when the player is not on the ground, preventing unrealistic movement behavior.

  • What adjustments are made to the jumping behavior in the script?

    -The jump function is designed to apply a vertical force when the player is grounded. The jump height is adjusted with a square root function to ensure a realistic jump arc, and gravity is modified to prevent the player from floating in the air.

  • How does the player look functionality work in the game?

    -The 'player look' functionality uses mouse or gamepad input to rotate the player's camera. The mouse X and Y input values are used to rotate the player and camera along the horizontal and vertical axes, with sensitivity factors applied for better control.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
Unity GameFirst PersonGame DevelopmentCharacter ControllerInput SystemMovement MechanicsShooting GamePlayer InteractionAI IntegrationGame DesignUnity Tutorial