Esempio n. 1
0
        internal bool RaycastClosest(Vector3 a_from, Vector3 a_to, out RaycastResultClosest a_result)
        {
            a_result = new RaycastResultClosest();

            // Saves time if there is no objects there is no possible way for it to hit anything
            if (m_objectLookup.Count <= 0)
            {
                return(false);
            }

            IntPtr ptr;

            float nX;
            float nY;
            float nZ;

            float pX;
            float pY;
            float pZ;

            DiscreteDynamicsWorld_raycastClosest(m_objectPtr, a_from.X, a_from.Y, a_from.Z, a_to.X, a_to.Y, a_to.Z, out ptr, out nX, out nY, out nZ, out pX, out pY, out pZ);

            a_result.HitObject = null;

            if (ptr != IntPtr.Zero)
            {
                a_result.HitPosition = new Vector3(pX, pY, pZ);
                a_result.HitNormal   = new Vector3(nX, nY, nZ);

                a_result.HitObject = m_objectLookup[ptr];

                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 public bool RaycastClosest(Vector3 a_from, Vector3 a_to, out RaycastResultClosest a_result)
 {
     return(m_world.RaycastClosest(a_from, a_to, out a_result));
 }