Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

I cannot jump in my game

Discussion in 'General Discussion' started by Kryolitic, Nov 4, 2021.

  1. Kryolitic

    Kryolitic

    Joined:
    Nov 4, 2021
    Posts:
    2
    I was watching this video by by Brackeys on how to add first person player movement to my game and tried to implement jumping into it as shown in the video but it didn't really work out. Does anyone know how to fix this? :
     

    Attached Files:

  2. thecloudkeeper

    thecloudkeeper

    Joined:
    Sep 21, 2021
    Posts:
    28
    Have you created a Ground layer and assigned your ground GameObjects to that layer? And have you selected that in PlayerMovement inspector?
     
  3. Kryolitic

    Kryolitic

    Joined:
    Nov 4, 2021
    Posts:
    2
    Thanks! I assigned the ground layer and now it works!
     
    thecloudkeeper likes this.
  4. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    Just a heads up, I love Brackeys, but this method is TERRIBLE.

    It has an input delay, and the controller is not subject to forces without some finagling.

    If you want things like rocket jumps you’ll want to make a custom controller.

    I’m having a lot of success with creating a rigidbody and multiple colliders to make a physics based controller that also respect slopes and steps.

    Basically I shoot a ray straight down and tell the player to mark itself as grounded, then move the player up about a meter, and to go into “slide” mode when the normal of the floor is too steep.

    This allows the player to walk up any steps smaller than a meter without any issues.

    You will never get stuck, it is so stupid simple to build levels for, and it’s fairly low hit on performance.

    Also, make sure to give the movement collider zero friction and lock all rotations.
     
    thecloudkeeper likes this.