Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity spherecast

void CheckSpherecast(float radius, float detectableDistance, LayerMask detectableLayer) {
  Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);
  RaycastHit hitInfo;
  if (Physics.SphereCast(ray, radius, out hitInfo, detectableDistance, detectableLayer)) {
    Debug.Log(hitInfo);
  }
}
 
PREVIOUS NEXT
Tagged: #unity #spherecast
ADD COMMENT
Topic
Name
4+9 =