BEPUphysics.BroadPhaseEntries.MobileCollidables.MobileMeshCollidable.RayCast C# (CSharp) Метод

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

Tests a ray against the surface of the mesh. This does not take into account solidity.
public RayCast ( Ray ray, float maximumLength, TriangleSidedness sidedness, RayHit &rayHit ) : bool
ray Ray Ray to test.
maximumLength float Maximum length of the ray to test; in units of the ray's direction's length.
sidedness TriangleSidedness Sidedness to use during the ray cast. This does not have to be the same as the mesh's sidedness.
rayHit BEPUutilities.RayHit The hit location of the ray on the mesh, if any.
Результат bool
        public bool RayCast(Ray ray, float maximumLength, TriangleSidedness sidedness, out RayHit rayHit)
        {
            //Put the ray into local space.
            Ray localRay;
            Matrix3x3 orientation;
            Matrix3x3.CreateFromQuaternion(ref worldTransform.Orientation, out orientation);
            Matrix3x3.TransformTranspose(ref ray.Direction, ref orientation, out localRay.Direction);
            Vector3.Subtract(ref ray.Position, ref worldTransform.Position, out localRay.Position);
            Matrix3x3.TransformTranspose(ref localRay.Position, ref orientation, out localRay.Position);

            if (Shape.TriangleMesh.RayCast(localRay, maximumLength, sidedness, out rayHit))
            {
                //Transform the hit into world space.
                Vector3.Multiply(ref ray.Direction, rayHit.T, out rayHit.Location);
                Vector3.Add(ref rayHit.Location, ref ray.Position, out rayHit.Location);
                Matrix3x3.Transform(ref rayHit.Normal, ref orientation, out rayHit.Normal);
                return true;
            }
            rayHit = new RayHit();
            return false;
        }

Same methods

MobileMeshCollidable::RayCast ( Ray ray, float maximumLength, RayHit &rayHit ) : bool