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


C# b2FixtureDef.SetAsBox方法代码示例

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


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

示例1: SensorTest

        public SensorTest()
        {
            {
                b2BodyDef bd  = new b2BodyDef();
                b2Body ground = m_world.CreateBody(bd);

                {
                    b2EdgeShape shape = new b2EdgeShape();
                    shape.Set(new b2Vec2(-40.0f, 0.0f), new b2Vec2(40.0f, 0.0f));
                    ground.CreateFixture(shape, 0.0f);
                }

#if false
            {
                b2FixtureDef sd = new b2FixtureDef();
                sd.SetAsBox(10.0f, 2.0f, new b2Vec2(0.0f, 20.0f), 0.0f);
                sd.isSensor = true;
                m_sensor = ground.CreateFixture(sd);
            }
#else
                {
                    b2CircleShape shape = new b2CircleShape();
                    shape.Radius = 5.0f;
                    shape.Position = new b2Vec2(0.0f, 10.0f);

                    b2FixtureDef fd = new b2FixtureDef();
                    fd.shape = shape;
                    fd.isSensor = true;
                    m_sensor = ground.CreateFixture(fd);
                }
#endif
            }

            {
                b2CircleShape shape = new b2CircleShape();
                shape.Radius = 1.0f;

                for (int i = 0; i < e_count; ++i)
                {
                    b2BodyDef bd  = new b2BodyDef();
                    bd.type = b2BodyType.b2_dynamicBody;
                    bd.position.Set(-10.0f + 3.0f * i, 20.0f);
                    bd.userData = i; //  m_touching[i];

                    m_touching[i] = false;
                    m_bodies[i] = m_world.CreateBody(bd);

                    m_bodies[i].CreateFixture(shape, 1.0f);
                }
            }
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:51,代码来源:SensorTest.cs


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