Obtenga la posición mundial del mouse

public Vector3 worldPosition;

void Update()
{
    Plane plane = new Plane(Vector3.up, 0);

    float distance;
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    if (plane.Raycast(ray, out distance))
    {
        worldPosition = ray.GetPoint(distance);
    }
}Copy
Omadel