Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Unity mousetoterrainposition

public static Vector3 MouseToTerrainPosition()
    {
        Vector3 position = Vector3.zero;
        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out RaycastHit info, 100, LayerMask.GetMask("Level")))
            position = info.point;
        return position;
    }
 
PREVIOUS NEXT
Tagged: #Unity #mousetoterrainposition
ADD COMMENT
Topic
Name
8+2 =