W
W
WasTabon2021-04-26 15:44:12
Unity
WasTabon, 2021-04-26 15:44:12

IDragHandler for 3d objects?

For some reason it doesn't work for me

public void OnDrag(PointerEventData eventData)
    {
        eventVector3 = Camera.main.ScreenToWorldPoint(eventData.position);
        Debug.Log(eventVector3);
        gameObject.transform.position = new Vector3(eventVector3.x, 4.4f, eventVector3.z);
    }

The object is simply transferred to the coordinates -4.23, 4.4, -2.58 and does not react to clicks at all, what should I do?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question