Quantcast
Viewing all articles
Browse latest Browse all 56

Making a jump with Rigidbody2D character

I'm trying out the newish Unity 2D features. I'm trying to make a basic platformer. I've got left/right movement working with AddForce but I'm getting stuck on the jump. Here's what I have: if (Input.GetKeyDown(KeyCode.Space) & grounded) { jumping = true; rigidbody2D.AddForce(jumpForce * Time.deltaTime); } The problem with using the AddForce method is that to get the character to jump I have to set an quite high value to the jumpForce vector, and when adding a big force the character "teleports" quite high quite fast: it's not a smooth jump. How would you make a Rigidbody2D jump for a 2d platform game?

Viewing all articles
Browse latest Browse all 56

Trending Articles