Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Line
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Returns the mouse coordinates in the world coordinates format to the mousePos variable.
And then, if you need to detect a mouse click on an object using void OnMouseDown(), and if it is that object, start moving. You will get something like this:
void OnMouseOver()
{
if (<проверка, нужный ли тебе объект>)
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
<перемещение твоего объекта в позицию mousePos>
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question