/// <summary>コンストラクタ</summary> public RaycastResult(Transform transform, Vector3 position, Vector3 normal, Vector3 direction, LayerMaskEx layerMask, float distance) { this.transform = transform; this.position = position; this.normal = normal; this.direction = direction; this.layerMask = layerMask; this.distance = distance; }
/// <summary>コンストラクタ</summary> public BoxCastResult(Transform transform, Vector3 position, Vector3 normal, LayerMaskEx layerMask, float distance, bool isResultOfRaycast) { this.transform = transform; this.position = position; this.normal = normal; this.layerMask = layerMask; this.distance = distance; this.isResultOfRaycast = isResultOfRaycast; }
// Update is called once per frame private void Update() { var ray = new Ray(this.transform.position, Vector3.down); int hitCount = Physics.RaycastNonAlloc( ray, this.hits, 1000, LayerMaskEx.Invert(this.projector.ignoreLayers)); this.projector.enabled = hitCount > 0; if (hitCount > 0) { this.projector.farClipPlane = this.hits[hitCount - 1].distance; } }