Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Having a problem in the jump

I'm making my version of cubethon by adding new mechanics to it as a jump and a crouch mechanic and i'm stuck in a weird jump bug that i saw lately its that the jumps are not equal

im adding a force in the y axis while jumping but idk why i see a diffrence between the jumps i tried changing addForce to rb.velocity but i got the same issue

here is some Details :

 private float jumpForce = 10f;

  private Vector3 movedir;

  public Rigidbody rb;

  public float sideWaySpeed = 100f;

  private float hori;

  private bool jumpInput = false;

  public LayerMask Ground;

  private bool CrouchCheck;

   

  public float forceSpeed = 75f

  public float minSpeedForce = 55f

  public float maxSpeedForce = 75f;


 private void Update()

  {

    hori = Input.GetAxisRaw("Horizontal");

    jumpInput = Input.GetButtonDown("Jump");

    CrouchCheck = Input.GetKey(KeyCode.C);

    


  }

  private void Jump()

  {

    if (!CrouchCheck&&jumpInput && Grounded())

    {


      rb.AddForce(Vector3.up * jumpForce * Time.fixedDeltaTime, ForceMode.Impulse);


      

    }

  }


  private bool Grounded()

  {

    return Physics.Raycast(transform.position, Vector3.down,1f, Ground);

  }


  

Best Answer

  • Accepted Answer

    Try asking on the brackeys discord server since this it will take longer to get answers on this site : )

    Good Luck

Answers

Sign In or Register to comment.