Create a gist now

Instantly share code, notes, and snippets.

@tak-km /targets.cs
Last active Jan 23, 2017

What would you like to do?
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