当前位置: 首页>>代码示例>>C#>>正文


C# b2FixtureDef.Defaults方法代码示例

本文整理汇总了C#中Box2D.Dynamics.b2FixtureDef.Defaults方法的典型用法代码示例。如果您正苦于以下问题:C# b2FixtureDef.Defaults方法的具体用法?C# b2FixtureDef.Defaults怎么用?C# b2FixtureDef.Defaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Box2D.Dynamics.b2FixtureDef的用法示例。


在下文中一共展示了b2FixtureDef.Defaults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CharacterCollision


//.........这里部分代码省略.........
                bd.position.Set(-10.0f, 4.0f);
                b2Body ground = m_world.CreateBody(bd);

                b2Vec2[] vs = new b2Vec2[10];
                vs[0].Set(0.0f, 0.0f);
                vs[1].Set(6.0f, 0.0f);
                vs[2].Set(6.0f, 2.0f);
                vs[3].Set(4.0f, 1.0f);
                vs[4].Set(2.0f, 2.0f);
                vs[5].Set(0.0f, 2.0f);
                vs[6].Set(-2.0f, 2.0f);
                vs[7].Set(-4.0f, 3.0f);
                vs[8].Set(-6.0f, 2.0f);
                vs[9].Set(-6.0f, 0.0f);
                b2ChainShape shape = new b2ChainShape();
                shape.CreateLoop(vs, 10);
                ground.CreateFixture(shape, 0.0f);
            }

            // Square character 1
            {
                b2BodyDef bd  = new b2BodyDef();
                bd.position.Set(-3.0f, 8.0f);
                bd.type = b2BodyType.b2_dynamicBody;
                bd.fixedRotation = true;
                bd.allowSleep = false;

                b2Body body = m_world.CreateBody(bd);

                b2PolygonShape shape = new b2PolygonShape();
                shape.SetAsBox(0.5f, 0.5f);

                b2FixtureDef fd = new b2FixtureDef();
                fd.Defaults();
                fd.shape = shape;
                fd.density = 20.0f;
                body.CreateFixture(fd);
            }

            // Square character 2
            {
                b2BodyDef bd  = new b2BodyDef();
                bd.position.Set(-5.0f, 5.0f);
                bd.type = b2BodyType.b2_dynamicBody;
                bd.fixedRotation = true;
                bd.allowSleep = false;

                b2Body body = m_world.CreateBody(bd);

                b2PolygonShape shape = new b2PolygonShape();
                shape.SetAsBox(0.25f, 0.25f);

                b2FixtureDef fd = new b2FixtureDef();
                fd.Defaults();
                fd.shape = shape;
                fd.density = 20.0f;
                body.CreateFixture(fd);
            }

            // Hexagon character
            {
                b2BodyDef bd  = new b2BodyDef();
                bd.position.Set(-5.0f, 8.0f);
                bd.type = b2BodyType.b2_dynamicBody;
                bd.fixedRotation = true;
                bd.allowSleep = false;
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:67,代码来源:CharacterCollision.cs

示例2: Create

 public static b2FixtureDef Create()
 {
     b2FixtureDef d = new b2FixtureDef();
     d.Defaults();
     return (d);
 }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:6,代码来源:b2FixtureDef.cs


注:本文中的Box2D.Dynamics.b2FixtureDef.Defaults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。