Answer the question
In order to leave comments, you need to log in
How to replace Input.GetMouseButtonDown with a specific point?
Hello. I am new to Unity and C#.
Here is the part of the code where the end point of the movement is set:
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit))
{
Graphway.FindPath(transform.position, hit.point, FindPathCallback, true, debugMode);
}
}
How it is possible to replace GetMouseButton so that it would be possible to write placement, coordinates of a certain point?
Answer the question
In order to leave comments, you need to log in
It seems that Unity has a cursor position function. On the update, you check for a click, if there is, then you take the coordinates and do something with them
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question