Ejemplo n.º 1
0
        public MassAggregateApplication(int particleCount)
        {
            World = new ParticleWorld(particleCount * 10);

            for (int i = 0; i < particleCount; i++)
            {
                World.Particles.Add(new Particle());
            }

            GroundContactGenerator = new GroundContacts(World.Particles);
            World.ContactGenerators.Add(GroundContactGenerator);
        }
Ejemplo n.º 2
0
        protected void OnDetectGround(IEnumerable <Collider> grounds)
        {
            lock (_grounds)
            {
                var collection = grounds.ToHashSet();

                var oldContacts = GroundContacts.Except(collection);
                var contacts    = collection.Except(GroundContacts);

                oldContacts.ForEach(c => _grounds.Remove(c));
                contacts.ForEach(c => _grounds.Add(c));
            }
        }