Skip to main content

iI solved my little problem here. for those who may need This is the solution I came up with:

Ray ray;
RaycastHit hit;

ray = Camera.current.ScreenPointToRay(new Vector3(Event.current.mousePosition.x, SceneView.currentDrawingSceneView.camera.pixelHeight - Event.current.mousePosition.y));

    if (Physics.Raycast(ray, out hit))
                    {
                        x1 = Input.mousePosition.x;
                        y1 = Input.mousePosition.y;
                        z1 = Input.mousePosition.z;
                        x2 = hit.point.x;
                        y2 = 0;
                        z2 = hit.point.z;
                    }

// This script gets the mouse coordinates on the "y" y- plane, (ifplane if there is a collider on the y-plane).

x2,x2,z2 are the result coordinates.

i solved my little problem here. for those who may need:

Ray ray;
RaycastHit hit;

ray = Camera.current.ScreenPointToRay(new Vector3(Event.current.mousePosition.x, SceneView.currentDrawingSceneView.camera.pixelHeight - Event.current.mousePosition.y));

    if (Physics.Raycast(ray, out hit))
                    {
                        x1 = Input.mousePosition.x;
                        y1 = Input.mousePosition.y;
                        z1 = Input.mousePosition.z;
                        x2 = hit.point.x;
                        y2 = 0;
                        z2 = hit.point.z;
                    }

// gets the mouse coordinates on the "y" - plane, (if there is a collider on the y-plane)

x2,x2,z2 are the coordinates.

I solved my little problem. This is the solution I came up with:

Ray ray;
RaycastHit hit;

ray = Camera.current.ScreenPointToRay(new Vector3(Event.current.mousePosition.x, SceneView.currentDrawingSceneView.camera.pixelHeight - Event.current.mousePosition.y));

if (Physics.Raycast(ray, out hit))
{
    x1 = Input.mousePosition.x;
    y1 = Input.mousePosition.y;
    z1 = Input.mousePosition.z;
    x2 = hit.point.x;
    y2 = 0;
    z2 = hit.point.z;
}

This script gets the mouse coordinates on the y-plane if there is a collider on the y-plane.

x2,x2,z2 are the result coordinates.

Source Link
OC_RaizW
  • 1.5k
  • 8
  • 27
  • 49

i solved my little problem here. for those who may need:

Ray ray;
RaycastHit hit;

ray = Camera.current.ScreenPointToRay(new Vector3(Event.current.mousePosition.x, SceneView.currentDrawingSceneView.camera.pixelHeight - Event.current.mousePosition.y));

    if (Physics.Raycast(ray, out hit))
                    {
                        x1 = Input.mousePosition.x;
                        y1 = Input.mousePosition.y;
                        z1 = Input.mousePosition.z;
                        x2 = hit.point.x;
                        y2 = 0;
                        z2 = hit.point.z;
                    }

// gets the mouse coordinates on the "y" - plane, (if there is a collider on the y-plane)

x2,x2,z2 are the coordinates.