I need to get a square from the vertices where the beam hit, namely where I poked the mouse in terrain
if(Input.GetMouseButtonDown(0)){
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out RayHit, Mathf.Infinity, ignoreLayerMask)){
Debug.Log(RayHit.collider.tag); // if terrain
Debug.Log(RayHit.point);// hit to face
// get 4 vertex from hit face ?
}
}
How to calculate them?
(not mesh, terrain…)