BEPUphysics.CollisionShapes.StaticGroupShape.RayCast C# (CSharp) Метод

RayCast() публичный Метод

Tests a ray against the collidable.
public RayCast ( BEPUutilities.Ray ray, float maximumLength, bool>.Func filter, RayCastResult &result ) : bool
ray BEPUutilities.Ray Ray to test.
maximumLength float Maximum length, in units of the ray's direction's length, to test.
filter bool>.Func Test to apply to the entry. If it returns true, the entry is processed, otherwise the entry is ignored. If a collidable hierarchy is present /// in the entry, this filter will be passed into inner ray casts.
result RayCastResult Hit data, if any.
Результат bool
        public bool RayCast(Ray ray, float maximumLength, Func<BroadPhaseEntry, bool> filter, out RayCastResult result)
        {
            var outputOverlappedElements = PhysicsResources.GetCollidableList();
            CollidableTree.GetOverlaps(ray, maximumLength, outputOverlappedElements);
            result = new RayCastResult();
            result.HitData.T = float.MaxValue;
            for (int i = 0; i < outputOverlappedElements.Count; ++i)
            {
                RayHit hit;
                if (outputOverlappedElements.Elements[i].RayCast(ray, maximumLength, filter, out hit))
                {
                    if (hit.T < result.HitData.T)
                    {
                        result.HitData = hit;
                        result.HitObject = outputOverlappedElements.Elements[i];
                    }
                }
            }
            PhysicsResources.GiveBack(outputOverlappedElements);
            return result.HitData.T < float.MaxValue;
        }

Same methods

StaticGroupShape::RayCast ( BEPUutilities.Ray ray, float maximumLength, RayCastResult &result ) : bool