Пример #1
0
        /// <summary>
        /// Construct a world object.
        /// </summary>
        /// <param name="gravity">the world gravity vector.</param>
        /// <param name="doSleep">improve performance by not simulating inactive bodies.</param>
        public World(Vec2 gravity, IWorldPool argPool)
        {
            contactStacks = new ContactRegister[ShapeTypesCount][];
            for (int i = 0; i < ShapeTypesCount; i++)
            {
                contactStacks[i] = new ContactRegister[ShapeTypesCount];
            }

            pool = argPool;
            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_Renamed(gravity);

            m_flags = CLEAR_FORCES;

            m_inv_dt0 = 0f;

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

            initializeRegisters();
        }
Пример #2
0
        /// <summary>
        /// Construct a world object.
        /// </summary>
        /// <param name="gravity">the world gravity vector.</param>
        /// <param name="argPool"> </param>
        public World(Vec2 gravity, IWorldPool argPool)
        {
            contactStacks = new ContactRegister[ShapeTypesCount][];
            for (int i = 0; i < ShapeTypesCount; i++)
            {
                contactStacks[i] = new ContactRegister[ShapeTypesCount];
            }

            Pool = argPool;
            DestructionListener = null;
            DebugDraw = null;

            BodyList = null;
            JointList = null;

            BodyCount = 0;
            JointCount = 0;

            WarmStarting = true;
            ContinuousPhysics = true;
            m_subStepping = false;
            m_stepComplete = true;

            SleepingAllowed = true;
            m_gravity.Set(gravity);

            Flags = CLEAR_FORCES;

            invDt0 = 0f;

            ContactManager = new ContactManager(this);
            Profile = new Profile();

            InitializeRegisters();
        }
Пример #3
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;
            }
        }
Пример #4
0
        private void AddType(IDynamicStack<Contact> creator, ShapeType type1, ShapeType type2)
        {
            ContactRegister register = new ContactRegister {Creator = creator, Primary = true};
            contactStacks[(int)type1][(int)type2] = register;

            if (type1 != type2)
            {
                ContactRegister register2 = new ContactRegister {Creator = creator, Primary = false};
                contactStacks[(int)type2][(int)type1] = register2;
            }
        }