- Home /
Question by
ahsan145ali · Aug 03, 2020 at 02:02 PM ·
androidmovement2d game2d-platformerjumping object
PLayer not landing afteer jumping,Player jumping by clicking button
public void jumping() {
Debug.Log("Pressed");
if (canjump)
{
rb.velocity = new Vector2(rb.velocity.x, 5f);
}
}
for android
making a player jump by pressing the button and button has the above code attached on click but after the jumping the player doesn't land back on the floor it keeps going up
Comment
Answer by Infenix · Aug 03, 2020 at 02:22 PM
Make sure your rigibody is using gravity. There is a checkbox Use Gravity in the inspector. The mass also need to be different from 0. If it doesn't change anything, check your gravity settings (Project settings -> Physics 2D). The y gravity should be at -9.8 by default