Ejemplo n.º 1
0
        // Modifies completedCollisions by always trying to add the new collision pair to the list
        private bool ShouldSkipCollisionCheck(JCollider colliderA, JCollider colliderB, HashSet <JCollisionPair> completedCollisions)
        {
            if (!JLayerMaskUtil.MaskCheck(JLayerMaskUtil.GetLayerMask(colliderA.jLayer), colliderB.jLayer))
            {
                return(true);
            }

            var collisionPair = new JCollisionPair(colliderA, colliderB);

            if (!completedCollisions.Add(collisionPair))    // This is where the methods mutates completedCollisions
            {
                return(true);
            }

            var boundsA = colliderA.meshFrame.AABB;
            var boundsB = colliderB.meshFrame.AABB;

            if (!JMeshOverlap.AABBOverlap(boundsA, boundsB))
            {
                return(true);
            }

            var meshA = colliderA.meshFrame;
            var meshB = colliderB.meshFrame;

            if (!JMeshOverlap.MeshesOverlap(meshA, meshB))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 public void Add(JCollisionPair element)
 {
     CurrentFrame.Add(element);
 }