當前位置: 首頁>>代碼示例>>Java>>正文


Java Fixture.getShape方法代碼示例

本文整理匯總了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);
}
 
開發者ID:mediamonks,項目名稱:tilt-game-android,代碼行數:19,代碼來源:RenderOfPolyFixture.java

示例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.");
    }
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:16,代碼來源:BuoyancyController.java

示例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;
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:20,代碼來源:BuoyancyController.java

示例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);
}
 
開發者ID:mediamonks,項目名稱:tilt-game-android,代碼行數:12,代碼來源:RenderOfCircleFixture.java

示例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();
}
 
開發者ID:Deftwun,項目名稱:ZombieCopter,代碼行數:12,代碼來源:FixtureModel.java


注:本文中的com.badlogic.gdx.physics.box2d.Fixture.getShape方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。