Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether two collision objects are in contact.
        /// </summary>
        /// <param name="objectA">The collision object A.</param>
        /// <param name="objectB">The collision object B.</param>
        /// <returns>
        /// <see langword="true"/> if the objects are touching (or penetrating); otherwise
        /// <see langword="false"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="objectA"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="objectB"/> is <see langword="null"/>.
        /// </exception>
        public bool HaveContact(CollisionObject objectA, CollisionObject objectB)
        {
            if (objectA == null)
            {
                throw new ArgumentNullException("objectA");
            }
            if (objectB == null)
            {
                throw new ArgumentNullException("objectB");
            }

            ContactSet contactSet = ContactSet.Create(objectA, objectB);

            ComputeCollision(contactSet, CollisionQueryType.Boolean);
            CheckResult(contactSet, false);

            bool haveContact = contactSet.HaveContact;

            contactSet.Recycle();
            return(haveContact);
        }