Exemple #1
0
    /// Dump this body to a log file
    public void Dump()
    {
        int bodyIndex = m_islandIndex;

        Utils.b2Log("{\n");
        Utils.b2Log("  b2BodyDef bd;\n");
        Utils.b2Log("  bd.type = b2BodyType(%d);\n", m_type);
        Utils.b2Log("  bd.position.Set(%.15lef, %.15lef);\n", m_xf.p.x, m_xf.p.y);
        Utils.b2Log("  bd.angle = %.15lef;\n", m_sweep.a);
        Utils.b2Log("  bd.linearVelocity.Set(%.15lef, %.15lef);\n", m_linearVelocity.x, m_linearVelocity.y);
        Utils.b2Log("  bd.angularVelocity = %.15lef;\n", m_angularVelocity);
        Utils.b2Log("  bd.linearDamping = %.15lef;\n", m_linearDamping);
        Utils.b2Log("  bd.angularDamping = %.15lef;\n", m_angularDamping);
        Utils.b2Log("  bd.allowSleep = bool(%d);\n", m_flags & BodyFlags.e_autoSleepFlag);
        Utils.b2Log("  bd.awake = bool(%d);\n", m_flags & BodyFlags.e_awakeFlag);
        Utils.b2Log("  bd.fixedRotation = bool(%d);\n", m_flags & BodyFlags.e_fixedRotationFlag);
        Utils.b2Log("  bd.bullet = bool(%d);\n", m_flags & BodyFlags.e_bulletFlag);
        Utils.b2Log("  bd.active = bool(%d);\n", m_flags & BodyFlags.e_activeFlag);
        Utils.b2Log("  bd.gravityScale = %.15lef;\n", m_gravityScale);
        Utils.b2Log("  bodies[%d] = m_world->CreateBody(&bd);\n", m_islandIndex);
        Utils.b2Log("\n");
        for (b2Fixture f = m_fixtureList; f != null; f = f.m_next)
        {
            Utils.b2Log("  {\n");
            f.Dump(bodyIndex);
            Utils.b2Log("  }\n");
        }
        Utils.b2Log("}\n");
    }