コード例 #1
0
        public override ActionStatus OnUpdate()
        {
            Vector3    startPosition = this.m_TargetTransform.position;
            Vector3    direction     = PhysicsUtility.GetDirection(this.m_TargetTransform, this.m_Direction);
            RaycastHit hit;

            if (Physics.SphereCast(startPosition + Vector3.up * 0.2f, this.m_Radius, direction, out hit, this.m_MaxDistance, this.m_LayerMask, this.m_QueryTriggerInteraction) && this.m_HitSuccessLayer.Contains(hit.collider.gameObject.layer))
            {
                Debug.Log(hit.collider.name);
                return(ActionStatus.Success);
            }
            return(ActionStatus.Failure);
        }
コード例 #2
0
        protected virtual bool DoRaycast()
        {
            Vector3    startPosition = this.m_TargetTransform.position + this.m_TargetTransform.InverseTransformDirection(this.m_Offset);
            Vector3    direction     = PhysicsUtility.GetDirection(this.m_TargetTransform, this.m_Direction);
            RaycastHit hit;

            if (Physics.Raycast(startPosition, direction, out hit, this.m_MaxDistance, this.m_LayerMask, this.m_QueryTriggerInteraction) && this.m_HitLayer.Contains(hit.collider.gameObject.layer))
            {
                return(true);
            }

            return(false);
        }