Exemple #1
0
        public World(Vec2 gravity, IWorldPool pool, BroadPhase broadPhase)
        {
            this.pool = pool;
            m_destructionListener = null;
            m_debugDraw = null;

            m_bodyList = null;
            m_jointList = null;

            m_bodyCount = 0;
            m_jointCount = 0;

            m_warmStarting = true;
            m_continuousPhysics = true;
            m_subStepping = false;
            m_stepComplete = true;

            m_allowSleep = true;
            m_gravity.set(gravity);

            m_flags = CLEAR_FORCES;

            m_inv_dt0 = 0f;

            m_contactManager = new ContactManager(this, broadPhase);
            m_profile = new Profile();

            m_particleSystem = new ParticleSystem(this);

            for (int i = 0; i < contactStacks.Length; i++)
            {
                contactStacks[i] = new ContactRegister[Enum.GetValues(typeof (ShapeType)).Length];
            }

            initializeRegisters();
        }
Exemple #2
0
        private void addType(IDynamicStack<Contact> creator, ShapeType type1, ShapeType type2)
        {
            ContactRegister register = new ContactRegister();
            register.creator = creator;
            register.primary = true;
            contactStacks[(int) type1][(int) type2] = register;

            if (type1 != type2)
            {
                ContactRegister register2 = new ContactRegister();
                register2.creator = creator;
                register2.primary = false;
                contactStacks[(int) type2][(int) type1] = register2;
            }
        }