Guest User

Untitled

a guest
Jan 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. using UnityEngine.AI;
  2.  
  3. public class MouseScript : MonoBehaviour {
  4. public GameObject player;
  5.  
  6. void Update(){
  7. if (Input.GetMouseButtonDown(1)){
  8. RaycastHit hit;
  9.  
  10. if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
  11. {
  12. player.GetComponent<NavMeshAgent>().destination = hit.point;
  13. }
  14.  
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment