H
H
Helsiel2020-05-13 15:20:05
C++ / C#
Helsiel, 2020-05-13 15:20:05

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

1 answer(s)
P
Pythonchik3, 2020-05-13
@Pythonchik3

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 question

Ask a Question

731 491 924 answers to any question