//We apply all our player's physics in FixedUpdate void FixedUpdate() { //if movement is disabled, we want to set velocity to zero if (movementDiabled) { physics.velocity = Vector2.zero; return; } //apply our gravity and velocity and moving the transform with controller2D //We call this before vertical Collision so it doesn't set our velocity.y to 0 every frame which stops our player from jumping physics.ApplyPhysics(controller); //sets velocity.y to 0 when collision is detected in order to simulate vertical collisions physics.ApplyVerticalCollision(controller); //If the player is not dashing, we will move player horizontally if (!dashSettings.isDashing) { physics.ApplyHorizontalMovement(); } physics.DoGroundCheck(); //Resets our jump count when the player lands if (physics.isGrounded && physics.falling) { jumpSettings.jumpCount = jumpSettings.maxJumpCount; } }