Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine.AI;
- public class MouseScript : MonoBehaviour {
- public GameObject player;
- void Update(){
- if (Input.GetMouseButtonDown(1)){
- RaycastHit hit;
- if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
- {
- player.GetComponent<NavMeshAgent>().destination = hit.point;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment