move by click y axis

i would to set position from point to point by mouse click

!
any help plz

Well, you could start by using screen to world point :frowning:Unity - Scripting API: Camera.ScreenToWorldPoint)
this will get where the mouse cursor is clicking, then you could just move the position of the ball to the position of the raycast hit.

@h_amoz

using UnityEngine;
using System.Collections;

public class BallMover : MonoBehaviour 
{
//	NavMeshAgent nav; if you are using the nav mesh method

	Vector3 wantedPosition;

	/*
	void Start ()
	{
		nav = GetComponent<NavMeshAgent> ();
	}
	*/

	void Update ()
	{
		RayGenerator (); 
	}

	void FixedUpdate()
	{
		if (Input.GetMouseButtonDown (0)) //On left mouse buttom click
		{
			transform.position = wantedPosition;
			
			//or
			
			//nav.SetDestination(wantedPosition);  set a destination using the nav mesh method
		}
	}



	void RayGenerator ()
	{
		Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); //set a ray from your mouse position on the main camera
		RaycastHit hit;
		
		if (Physics.Raycast (ray, out hit, Mathf.Infinity))//if the ray did hit something
		{
			wantedPosition = new Vector3 (hit.point.x, hit.point.y, hit.point.z); //wantedPosition = ray's end position  
		}
	}
}

I tested this script attaching on the ball.