コード例 #1
0
ファイル: Test.cs プロジェクト: songfulin/CocosSharp
        public virtual void Step(Settings settings)
        {
            float timeStep = settings.hz > 0.0f ? 1.0f / settings.hz : 0.0f;

            if (settings.pause)
            {
                if (settings.singleStep)
                {
                    settings.singleStep = false;
                }
                else
                {
                    timeStep = 0.0f;
                }

                m_debugDraw.DrawString(5, m_textLine, "****PAUSED****");
                m_textLine += 15;
            }

            b2DrawFlags flags = 0;

            if (settings.drawShapes)
            {
                flags |= b2DrawFlags.e_shapeBit;
            }
            if (settings.drawJoints)
            {
                flags |= b2DrawFlags.e_jointBit;
            }
            if (settings.drawAABBs)
            {
                flags |= b2DrawFlags.e_aabbBit;
            }
            if (settings.drawPairs)
            {
                flags |= b2DrawFlags.e_pairBit;
            }
            if (settings.drawCOMs)
            {
                flags |= b2DrawFlags.e_centerOfMassBit;
            }
            m_debugDraw.SetFlags(flags);

            m_world.SetWarmStarting(settings.enableWarmStarting > 0);
            m_world.SetContinuousPhysics(settings.enableContinuous > 0);
            m_world.SetSubStepping(settings.enableSubStepping > 0);

            m_pointCount = 0;

            m_world.Step(timeStep, settings.velocityIterations, settings.positionIterations);

            if (timeStep > 0.0f)
            {
                ++m_stepCount;
            }
        }