示例#1
0
        public bool CCDCast(ODEBody ccdBody, Vec3 start, Vec3 end, int contactGroup,
                            out float minDistance)
        {
            Vec3 direction = end - start;

            if (Math.Abs(direction.X) < .0001f && Math.Abs(direction.Y) < .0001f &&
                Math.Abs(direction.Z) < .0001f)
            {
                minDistance = 0;
                return(false);
            }

            Ray ray = new Ray(start, direction);

            Vec3  dirNormal = ray.Direction;
            float length    = dirNormal.Normalize();

            Ode.dGeomRaySet(rayCastGeomID, ray.Origin.X, ray.Origin.Y, ray.Origin.Z,
                            dirNormal.X, dirNormal.Y, dirNormal.Z);
            Ode.dGeomRaySetLength(rayCastGeomID, length);

            return(Ode.DoCCDCast(neoAxisAdditionsID, ccdBody.bodyID, contactGroup, out minDistance));
        }