本文整理汇总了Java中org.jbox2d.dynamics.FixtureDef.setShape方法的典型用法代码示例。如果您正苦于以下问题:Java FixtureDef.setShape方法的具体用法?Java FixtureDef.setShape怎么用?Java FixtureDef.setShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jbox2d.dynamics.FixtureDef
的用法示例。
在下文中一共展示了FixtureDef.setShape方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Create
import org.jbox2d.dynamics.FixtureDef; //导入方法依赖的package包/类
@Override
public void Create()
{
BodyDef def = new BodyDef();
def.position.set(new Vec2(x, y));
def.type = type;
def.angle = 0;
this.body = Game.world.createBody(def);
PolygonShape shape = new PolygonShape();
shape.setAsBox(w/2, h/2);
FixtureDef fixture = new FixtureDef();
Filter filter = new Filter();
filter.groupIndex = 1;
fixture.density = 0.1f;
fixture.setShape(shape);
fixture.setFilter(filter);
fixture.isSensor = false;
fixture.setFriction(0.5f);
fixture.friction = 1;
fixture.setUserData(this.sprite);
Physics.SetPhysicsAccordingly(this.body, fixture, information);
body.createFixture(fixture);
}
示例2: GroundPhysics
import org.jbox2d.dynamics.FixtureDef; //导入方法依赖的package包/类
public GroundPhysics(float x, float y, float w, float h, BodyType type, Ground ground)
{
super(new PhysicsInformation(0, 0, false));
BodyDef def = new BodyDef();
def.position.set(new Vec2(x, y));
def.type = type;
def.angle = 0;
this.body = Game.world.createBody(def);
PolygonShape shape = new PolygonShape();
shape.setAsBox(w/2, h/2);
FixtureDef fixture = new FixtureDef();
Filter filter = new Filter();
filter.groupIndex = 1;
fixture.density = 0.1f;
fixture.setShape(shape);
fixture.setFilter(filter);
fixture.isSensor = false;
fixture.setFriction(0.5f);
fixture.restitution = 0;
fixture.density = 1;
fixture.friction = 1;
fixture.setUserData(ground);
body.createFixture(fixture);
}
示例3: Create
import org.jbox2d.dynamics.FixtureDef; //导入方法依赖的package包/类
@Override
public void Create()
{
BodyDef def = new BodyDef();
def.position.set(new Vec2(x, y));
def.type = type;
def.angle = 0;
this.body = Game.world.createBody(def);
PolygonShape shape = new PolygonShape();
shape.setAsBox(w/2, h/2);
FixtureDef fixture = new FixtureDef();
Filter filter = new Filter();
filter.groupIndex = 1;
fixture.density = 0.1f;
fixture.setShape(shape);
fixture.setFilter(filter);
fixture.isSensor = false;
fixture.setFriction(0.5f);
fixture.friction = 1;
fixture.setUserData(box);
//Physics.SetPhysicsAccordingly(this.body, fixture, information);
body.createFixture(fixture);
}