本文整理匯總了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();
}