当前位置: 首页>>代码示例>>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;未经允许,请勿转载。