Modify Rigidbody2D Jump distance

I’m using rigidbody2D.velocity to move my character around based on keyboard input. Is there a way to modify the distance portion of the velocity when the character jumps? Right now, the character jumps way too far. I’m currently using addforce, but that doesn’t seem to get me what I want. I pretty much want to half the distance while keeping the time the same.

EDIT: Here’s my current code for the character controller:

using UnityEngine;
using System.Collections;

public class AvaController : MonoBehaviour 
	public float maxSpeed = 5f;
	private bool facingRight = true;

	Animator anim;

	bool grounded = false;
	public Transform groundCheck;
	float groundRadius = 0.2f;
	public LayerMask whatIsGround;

	private float move;

	public  bool jumping = false;
	public Vector2 jumpForce = new Vector2(120f, 330f);

	void Start() 
		anim = GetComponent<Animator>();

	void Update()
		print (rigidbody2D.velocity.x);
		print (jumping);
		// Allow jump in FixedUpdate

		// Play crouching animation
		if( grounded && Input.GetKey(KeyCode.S) )
			anim.SetBool("Crouching", true);
			anim.SetBool("Crouching", false);

	void FixedUpdate() 
		// Check to see if the player is touching a "ground"
		grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
		anim.SetBool("Ground", grounded);


		// If player is not on the ground, player cannot control the character
		if (!grounded)

		if (anim.GetBool("Crouching") == false)
			move = Input.GetAxis("Horizontal");
			anim.SetFloat("speed", Mathf.Abs(move));

			rigidbody2D.velocity = new Vector2(move * maxSpeed, rigidbody2D.velocity.y);	

		if( (move > 0) && (!facingRight) )
		else if( (move < 0) && (facingRight) )

	void JumpUpdate()
		if (!jumping) {
			if( (anim.GetBool("Crouching") == false) && grounded && Input.GetKeyDown(KeyCode.Space) )
				jumping = true;

	void Jump()
			rigidbody2D.AddForce(new Vector2(0f, jumpForce.y));
			anim.SetFloat("vSpeed", rigidbody2D.velocity.y);
			anim.SetBool("Ground", false);

			if(rigidbody2D.velocity.x != 0)
				rigidbody2D.AddForce(new Vector2(-5.8f, 0f));
				print (rigidbody2D.velocity.x);
				rigidbody2D.velocity = new Vector2(0,rigidbody2D.velocity.y);

			if(rigidbody2D.velocity.y == 0)
				jumping = false;

	void Flip()
		facingRight = !facingRight;
		Vector3 avaScale = transform.localScale;
		avaScale.x *= -1;
		transform.localScale = avaScale;

This works perfectly if I comment out the rigidbody2d velocity in my horizontal movement code, but then they character can’t move left or right.

You’re jumping on Update but moving on FixedUpdate? AddForce on FixedUpdate as its a physics calc
You can check for the jump button on Update then action it on FixedUpdate.

Adding force is not an incremental thing in your script it just adds a force.

For mass of 1.

force = mass * acceleration

force = 1 x acceleration.

adding force will accelerate the rigid body over time.
In the y vector that speed will be restrained by the negative acceleration applied to the rigid body by gravity.

Going up at 330units / sec / sec, but decelerating at 9units / sec / sec.
eventually gravity wins and the speed is 0 and you have your max height before you start falling.
The max height is set by the time relationship between your jump force and gravity.
If you decreased the jump force.y you wouldn’t get as high, but wont travel as far because you would be in the air for less time.

You want it to jump as high but not as far?

decreased the jumpForce.x

remember that the jumpForce.x is in addition to your current speed (velocity) so adding force will add acceleration to the velocity of the rigidbody horizontally.

note: (You can try negating the current speed by saying

rigidbody2D.velocity = new Vector2(0, rigidbody2D.velocity.y);

in the beginning of your jump function. Unless you want to jump further when traveling faster)
I’ve not played too much with using AddForce to move a controllable rigidBody but the logic here makes sense.

It will accelerate slower forwards meaning that by the time the jumpForce.y has taken you up to your height and back down you’ve traveled forward less. Then when you’re grounded the movement calc takes care of slowing you down by setting your velocity.x.

With a bit of trial and error with setting your jumpForce.x you can set a distance in x the rigidbody will move during its rise and fall.
There are equations that will allow you to work out → for any given amount of seconds, when going from a speed of 0, how many meters will you travel if constantly accelerating at N meters per sec per sec. But i don’t know them off by heart.

A bit long winded but maybe that helps?