private void HitFirst(RaycastQuery query) { WebInterface.RaycastHitEntity hitEntity; ParcelScene scene; SceneController.i.TryGetScene(query.sceneId, out scene); RaycastResultInfo raycastInfo = raycastHandler.Raycast(GetUnityRayFromQuery(query), query.ray.distance, ~layerMaskTarget, scene); WebInterface.RayInfo rayInfo = GetRayInfoFromQuery(query); if (raycastInfo != null) { CollidersManager.i.GetColliderInfo(raycastInfo.hitInfo.hit.collider, out ColliderInfo colliderInfo); hitEntity = new WebInterface.RaycastHitEntity() { didHit = raycastInfo.hitInfo.isValid, hitNormal = raycastInfo.hitInfo.hit.normal, hitPoint = raycastInfo.hitInfo.hit.point, ray = rayInfo, entity = new WebInterface.HitEntityInfo() { entityId = colliderInfo.entity != null ? colliderInfo.entity.entityId : null, meshName = colliderInfo.meshName } }; } else { hitEntity = new WebInterface.RaycastHitEntity() { didHit = false, ray = rayInfo }; } WebInterface.ReportRaycastHitFirstResult(query.sceneId, query.queryId, query.queryType, hitEntity); }