本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Fixture.getShape方法的典型用法代码示例。如果您正苦于以下问题:Java Fixture.getShape方法的具体用法?Java Fixture.getShape怎么用?Java Fixture.getShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.Fixture
的用法示例。
在下文中一共展示了Fixture.getShape方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RenderOfPolyFixture
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public RenderOfPolyFixture(Fixture fixture, VertexBufferObjectManager pVBO) {
super(fixture);
PolygonShape fixtureShape = (PolygonShape) fixture.getShape();
int vSize = fixtureShape.getVertexCount();
float[] xPoints = new float[vSize];
float[] yPoints = new float[vSize];
Vector2 vertex = Vector2Pool.obtain();
for (int i = 0; i < fixtureShape.getVertexCount(); i++) {
fixtureShape.getVertex(i, vertex);
xPoints[i] = vertex.x * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT;
yPoints[i] = vertex.y * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT;
}
Vector2Pool.recycle(vertex);
mEntity = new PolyLine(0, 0, xPoints, yPoints, pVBO);
}
示例2: addBody
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
/**
* Adds a given fixture to the Fixtures container.
*
* @param fixture The fixture to be added.
*/
public void addBody(Fixture fixture) {
try {
PolygonShape polygon = (PolygonShape) fixture.getShape();
if (polygon.getVertexCount() > 2) {
fixtures.add(fixture);
}
} catch (ClassCastException e) {
Gdx.app.debug("BuoyancyController", "Fixture shape is not an instance of PolygonShape.");
}
}
示例3: getFixtureVertices
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
/**
* Getter for the Vertices of a given Fixture.
*
* @param fixture Fixture to be handled.
* @return List containing the Fixture's vertices.
*/
private List<Vector2> getFixtureVertices(Fixture fixture) {
PolygonShape polygon = (PolygonShape) fixture.getShape();
int verticesCount = polygon.getVertexCount();
List<Vector2> vertices = new ArrayList<>(verticesCount);
for (int i = 0; i < verticesCount; i++) {
Vector2 vertex = new Vector2();
polygon.getVertex(i, vertex);
vertices.add(new Vector2(fixture.getBody().getWorldPoint(vertex)));
}
return vertices;
}
示例4: RenderOfCircleFixture
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public RenderOfCircleFixture(Fixture fixture, VertexBufferObjectManager pVBO) {
super(fixture);
CircleShape fixtureShape = (CircleShape) fixture.getShape();
Vector2 position = fixtureShape.getPosition();
float radius = fixtureShape.getRadius() * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT;
mEntity = new Ellipse(position.x * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT,
position.y * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT,
radius, radius, pVBO);
}
示例5: fromFixture
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void fromFixture(Fixture f){
shapeModel = new ShapeModel(f.getShape());
Filter filterData = f.getFilterData();
filter.categoryBits = filterData.categoryBits;
filter.maskBits = filterData.maskBits;
filter.groupIndex = filterData.groupIndex;
sensor = f.isSensor();
density = f.getDensity();
friction = f.getFriction();
restitution = f.getRestitution();
}