本文整理汇总了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);
}
}
}