Check out example codes for "how to make an object point towards the mouse in unity". It will help you in understanding the concepts better.

Code Example 1

//Inside your update loop, add the following code:

//First, get the mouse position
Vector2 mousePosition = new Vector2 ( 
//Then, use unity's built-in lookAt function to do all the math for you:

Code Example 2

Vector3 mousePos = Input.mousePosition;
        mousePos = Camera.main.ScreenToWorldPoint(mousePos);
        Vector2 direction = new Vector2(mousePos.x - transform.position.x, mousePos.y - transform.position.y);
        transform.up = direction;

Code Example 3

using UnityEngine;     using System.Collections;          public class SCR_mouseRotation : MonoBehaviour {                  void Update () {             Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.z, 10);             Vector3 lookPos = Camera.main.ScreenToWorldPoint(mousePos);             lookPos = lookPos - transform.position;             float angle = Mathf.Atan2(lookPos.z, lookPos.x) * Mathf.Rad2Deg;             transform.rotation = Quaternion.AngleAxis(angle, Vector3.down); // Turns Right                 transform.rotation = Quaternion.AngleAxis(angle, Vector3.up); //Turns Left                      }     }

Learn ReactJs, React Native from