Finding the worldspace coordinates of an OnDrop?

So I’m using a 3D World Space canvas and I want to know the world location on a panel that the user drops something.

For example what is the Vector3 coordinate for that red “X”, taking into account the z depth?

I can get the screen space coordinate just fine by using “pointData.position”, but “pointData.worldPosition” always returns 0,0,0.

public void OnDrop(PointerEventData pointData)
{
Debug.Log("Screen Position : " + pointData.position);
Debug.Log("World Position : " + pointData.worldPosition);
}

I’ve looked through similar threads but they seemed to be doing something slightly different, and didn’t find any straightforward answers.

Thanks :slight_smile:

You ever find anything out about this? I’m also trying to use
pointData.pointerCurrentRaycast.worldPosition
and
pointData.pointerPressRaycast.worldPosition

They also return 0,0,0

I tried using ScreenToWorldPoint(pointData.position.x, pointData.position.y, pointData.pointerCurrentRaycast.distance)
which gets a lot closer to what I want, like it moves around, but it’s a little bit off. I think the raycast.distance is the wrong thing to pass to this.