using System.Collections;
using System.Collections.Generic;
public class MouseRayPoint : MonoBehaviour
public float smoothTime = 5f;
private Vector3 velocity = Vector3.zero;
public float speedMove = 10f;
mainRole = GameObject.Find("Cube");
Ray oneRayMouse = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(oneRayMouse, out OneShotOBJ);
if (Input.GetMouseButtonDown(0))
Debug.Log(OneShotOBJ.point+"== "+ OneShotOBJ.transform.name);
target= OneShotOBJ.point;
Vector3 targetPosition = target + new Vector3(0, 1, -1);
mainRole.transform.position = Vector3.SmoothDamp(mainRole.transform.position, targetPosition, ref velocity, smoothTime);
mainRole.transform.LookAt(target + new Vector3(0, 1.5f, 0));