Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

how to make ideal jump for platformer game ?

Discussion in 'Physics' started by Rnd--, Feb 26, 2015.

  1. Rnd--

    Rnd--

    Joined:
    Sep 27, 2012
    Posts:
    30
    hi guys, im making platformer games
    for jumping Im using add force like this
    Code (CSharp):
    1. if(Input.GetButtonDown("Jump"))
    2. {
    3.     rigidbody2D.AddForce(Vector2.up * jumpForce);
    4. }
    Im set jumpForce = 1000
    rigidBody.mass = 40
    rigidBody.gravityScale = 1
    gravity at physics2d (0, -9.81)

    but I think still something wrong,
    the jump seems look like astronout in space
    and its seems normal when Im set gravity scale = 5 and jumpforces = 20000
    but I think its not best practice :-s
    anybody had best practice for jump logic ??
    thx