Different Heel size on Android Unity 5 devices

0

I created a game type Infinite Runner that works correctly in the Game tab of Unity 5 but in android when I perform Jump in my character it has a rise always of different size, how can I solve this problem?

  

OBS: The app was tested on 2 different Androids (4.4.2 and 5.0) (have had the error in question).

Functions that perform Jump

void FixedUpdate () {
    CheckPlayerInGround();
    MakeJump();
    animator.SetBool("jump", !steppingDown);
}

void CheckPlayerInGround(){
    steppingDown = Physics2D.OverlapCircle(GroundCheck.position, 0.2f, whatIsGround);
}

void MakeJump(){
    if(Input.touchCount > 0){

        if((Input.GetTouch(0).position.x < Screen.width / 2) && steppingDown){
            if(slide == true){
                UpdateColliderScenarioPosition(0.37f);
                slide = false;
            }
            audio.PlayOneShot(audioJump);
            audio.volume = 0.75f;
            playerRigidbody2D.AddForce(new Vector2(0, jumpPower * Time.fixedDeltaTime));
        }
    }
}
    
asked by anonymous 08.01.2016 / 16:34

2 answers

1

To solve this problem you need to make two changes:

1) Change the jump condition to:

if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)

so that the jump action only happens once (the first time the screen is played).

2) Remove Time.fixedDeltaTime so that the character's jump height is always constant.

    
02.02.2016 / 18:06
0

When using drive within Unity using your Physics, it is not necessary to use the "Time" Class to multiply the value of the processor. In your case try removing the "Time.fixedDeltaTime".

    
22.01.2016 / 19:44