Last active
January 23, 2017 14:29
-
-
Save tak-km/b9f9185d167fbcda428627639df3806d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit; | |
float rayRange = 100f; | |
void Update () { | |
if (Input.GetMouseButtonDown(0)) { | |
if(Physics.Raycast(ray,out hit)) { | |
Vector3 targetPos = hit.point; | |
Debug.Log(targetPos); | |
Targets [count].transform.position = targetPos; | |
Targets [count].GetComponent<MeshRenderer> ().enabled = true; | |
tList.Add (Targets [count]); | |
target = tList [0].transform; | |
agent.SetDestination(target.position); | |
count += 1; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment