本文整理匯總了Java中com.badlogic.gdx.physics.box2d.BodyDef.BodyType方法的典型用法代碼示例。如果您正苦於以下問題:Java BodyDef.BodyType方法的具體用法?Java BodyDef.BodyType怎麽用?Java BodyDef.BodyType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.physics.box2d.BodyDef
的用法示例。
在下文中一共展示了BodyDef.BodyType方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createEntityBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
/**
* Erlaubt es den Unterklassen möglichst einfach einen beliebigen Box2D Körper zu erstellen.
*
* @param position die Startposition des Body
* @param shape die Form, die für dne Body verwendet werden soll
* @param type der Typ des Körpers
* @return ein Box2D Körper
*/
protected Body createEntityBody(Vector2 position, Shape shape, BodyDef.BodyType type)
{
position.scl(Physics.MPP);
BodyDef bodyDef = new BodyDef();
bodyDef.type = type;
bodyDef.position.set(position);
bodyDef.fixedRotation = true;
Body body = worldObjectManager.getPhysicalWorld().createBody(bodyDef);
body.setUserData(this);
FixtureDef fixture = new FixtureDef();
fixture.shape = shape;
fixture.filter.categoryBits = Physics.CATEGORY_ENTITIES;
fixture.filter.maskBits = Physics.MASK_ENTITIES;
body.createFixture(fixture).setUserData(this);
shape.dispose();
return body;
}
示例2: createGameObjectWithBox2DBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static GameObject createGameObjectWithBox2DBody(Vector2 gameObjectPos, Texture texture, Vector3 densityFrictionRestitution,
BodyDef.BodyType bodyType, Shape.Type shapeType,
World world) {
GameObject gameObject = new GameObject();
gameObject.setPosition(gameObjectPos.x, gameObjectPos.y);
gameObject.setTexture(texture);
gameObject.setSprite(new Sprite(texture));
gameObject.getSprite().setOriginCenter();
gameObject.setWorld(world);
BodyCreator bodyCreator = new BodyCreator();
gameObject.setBody(bodyCreator.createBody(new Vector2(gameObject.getX(), gameObject.getY()), texture, bodyType, world, shapeType, densityFrictionRestitution));
bodyCreator = null;
return gameObject;
}
示例3: createBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public Body createBody(Vector2 position, Texture texture, BodyDef.BodyType bodyType, World world, Shape.Type shape, Vector3 densityRestitutionFriction) {
this.texture = texture;
bodyDef = createBodyDef(bodyType, position);
body = world.createBody(bodyDef);
FixtureCreator.createFixture(body, createShape(shape), densityRestitutionFriction);
return body;
}
示例4: boxBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static Body boxBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float thickness,float density, float friction, float restitution,boolean isSensor){
Body b = world.createBody(bodyDef(type,position));
PolygonShape s = new PolygonShape();
FixtureDef fd = fixtureDef(density,friction,restitution,s,isSensor);
//top
s.setAsBox(dimensions.x, thickness, new Vector2(position.x,position.y + dimensions.y), 0);
fd.shape = s;
b.createFixture(fd);
//Bottom
s.setAsBox(dimensions.x, thickness, new Vector2(position.x,position.y - dimensions.y), 0);
fd.shape = s;
b.createFixture(fd);
//Left
s.setAsBox(thickness, dimensions.y, new Vector2(position.x - dimensions.x,position.y), 0);
fd.shape = s;
b.createFixture(fd);
//Right
s.setAsBox(thickness, dimensions.y, new Vector2(position.x + dimensions.x,position.y), 0);
fd.shape = s;
b.createFixture(fd);
s.dispose();
return b;
}
示例5: createBodyDef
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
private BodyDef createBodyDef(BodyDef.BodyType bodyType, Vector2 position) {
BodyDef bodyDef_ = new BodyDef();
bodyDef_.type = bodyType;
bodyDef_.position.set(position);
return bodyDef_;
}
示例6: getBodyType
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public BodyDef.BodyType getBodyType() {
return bodyDef.type;
}
示例7: getBodyType
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
@Override
protected BodyDef.BodyType getBodyType() {
return BodyDef.BodyType.DynamicBody;
}
示例8: getBodyType
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
protected BodyDef.BodyType getBodyType() {
return BodyDef.BodyType.StaticBody;
}
示例9: getBodyType
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
@Override
protected BodyDef.BodyType getBodyType() {
return BodyDef.BodyType.KinematicBody;
}
示例10: bodyDef
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static BodyDef bodyDef(BodyDef.BodyType type, Vector2 position){
BodyDef bd = new BodyDef();
bd.type = type;
bd.position.set(position);
return bd;
}
示例11: circleBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static Body circleBody(World world, BodyDef.BodyType type, Vector2 position, float radius, float density,float friction,float restitution,boolean isSensor){
Body b = world.createBody(bodyDef(type,position));
circleFixture(b,radius,density,friction,restitution,isSensor);
return b;
}
示例12: rectangleBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static Body rectangleBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float density,float friction, float restitution,boolean isSensor){
Body b = world.createBody(bodyDef(type,position));
rectangleFixture(b,dimensions,density,friction,restitution,isSensor);
return b;
}
示例13: triangleBody
import com.badlogic.gdx.physics.box2d.BodyDef; //導入方法依賴的package包/類
public static Body triangleBody(World world,BodyDef.BodyType type, Vector2 position, Vector2 dimensions, float density,float friction, float restitution,boolean isSensor){
Body b = world.createBody(bodyDef(type,position));
triangleFixture(b,dimensions,density,friction,restitution,isSensor);
return b;
}