Exemple #1
0
        private static void checkCollisions()
        {
            for (int j = 0; j <= particles.Count - 1; j++)
            {
                AbstractParticle pa = (AbstractParticle)particles[j];
                //DirectCast(particles.Item(j), AbstractParticle)

                int i = 0;

                for (i = j + 1; i <= particles.Count - 1; i++)
                {
                    AbstractParticle pb = (AbstractParticle)particles[i];
                    //DirectCast(particles.Item(i), AbstractParticle)
                    if ((pa.getCollidable() & pb.getCollidable()))
                    {
                        CollisionDetector.test(pa, pb);
                    }
                }

                for (int n = 0; n <= constraints.Count - 1; n++)
                {
                    if (constraints[n] is AngularConstraint)
                    {
                        //Do nothing
                    }
                    else
                    {
                        SpringConstraint c = (SpringConstraint)constraints[n];
                        if ((pa.getCollidable() & c.getCollidable() & (!c.isConnectedTo(pa))))
                        {
                            CollisionDetector.test(pa, c.getCollisionRect());
                        }
                    }
                }
                pa.isColliding = false;
            }
        }