# How to make object jump a specific distance ? Unity 3D

I’m a complete beginner so this might be simple. How can I make my player to jump to the end point of LineRenderer. So far I managed to make my player jump to the same direction that my LineRenderer points, but I want it to land at the end of the line.

I have this code:

``````using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Jump : MonoBehaviour
{
public Rigidbody rb;
public float height;
public Vector3 pos1;
public Vector3 pos2;
public LineRenderer i0;
public LineRenderer i1;
public float power;

void Start()
{
pos1 = i1.GetPosition(1);
pos2 = i0.GetPosition(0);
}

void FixedUpdate()
{

if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began && IsGrounded())
{
OnTouchJump(power);
}
}

public void OnTouchJump(float power)
{

Vector3 forceBB = new Vector3(0, 0, 0);
Vector3 dir = pos2 - pos1;
Vector3 n = pos1 + (dir / 2);
n = n + new Vector3(0, height, 0);
forceBB = n - pos1;
rb.AddForce(forceBB * power);
}

private bool IsGrounded()
{
return Physics.Raycast(transform.position, Vector3.down, 0.5f);
}
}
``````

I highly recommend looking at this talk. It’s a bit math heavy but it really helped me out on my game.
https://www.google.com/search?q=game+design+jump&oq=game+design+jump&aqs=chrome..69i57j0.5203j0j7&client=ms-unknown&sourceid=chrome-mobile&ie=UTF-8#

By having a LineRenderer point from your character to a target point (i.e. where you touch on the screen), this suggests a rather hands-off approach to making the jump. With that in mind, I would suggest taking a look at a previous post I made regarding trajectory.

Specifically, I could imagine that my examples of `HitTargetBySpeed()` or `HitTargetByAngle()` might be the sort of thing you’re looking for in this situation.