当前位置: 首页>>代码示例>>Java>>正文


Java EdgeShape.set方法代码示例

本文整理汇总了Java中org.jbox2d.collision.shapes.EdgeShape.set方法的典型用法代码示例。如果您正苦于以下问题:Java EdgeShape.set方法的具体用法?Java EdgeShape.set怎么用?Java EdgeShape.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jbox2d.collision.shapes.EdgeShape的用法示例。


在下文中一共展示了EdgeShape.set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.jbox2d.collision.shapes.EdgeShape; //导入方法依赖的package包/类
@Override
public void init(RunConfig config) throws InvalidTestFormatException {
	super.init(config);


	eshape = new EdgeShape();
	eshape.set(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f));
	shape = new PolygonShape();
	shape.setAsBox(0.6f, 0.125f);
	fixtureDef = new FixtureDef();
	fixtureDef.shape = shape;
	fixtureDef.density = 20.0f;
	fixtureDef.friction = 0.2f;
	bodyDef = new BodyDef();
	anchor = new Vec2(0, 0);
}
 
开发者ID:android-workloads,项目名称:JACWfA,代码行数:17,代码来源:ChainHighVP.java

示例2: createBorder

import org.jbox2d.collision.shapes.EdgeShape; //导入方法依赖的package包/类
private void createBorder(boolean top,boolean left, boolean bottom, boolean right) {
	

	BodyDef bd = new BodyDef();
	Body border = world.createBody(bd);
	EdgeShape es = new EdgeShape();
	if (left) {
		es.set(new Vec2(0, 0), new Vec2(0, screenHeight / RATE));
		border.createFixture(es, 0.0f);
	}
	if (bottom) {
		es.set(new Vec2(screenWidth / RATE, 0), new Vec2(screenWidth / RATE,
				screenHeight / RATE));
		border.createFixture(es, 0.0f);
	}
	if (right) {
		es.set(new Vec2(0, screenHeight / RATE), new Vec2(screenWidth / RATE,
				screenHeight / RATE));
		border.createFixture(es, 0.0f);
	}
	if (top) {
		es.set(new Vec2(0, 0), new Vec2(screenWidth / RATE, 0));
		border.createFixture(es, 0.0f);
	}
}
 
开发者ID:Jvaeyhcd,项目名称:Cut-Polygon,代码行数:26,代码来源:Stage4View.java

示例3: createBorder

import org.jbox2d.collision.shapes.EdgeShape; //导入方法依赖的package包/类
private void createBorder(boolean top,boolean left, boolean bottom, boolean right) {

		BodyDef bd = new BodyDef();
		Body border = world.createBody(bd);
		EdgeShape es = new EdgeShape();
		if (left) {
			es.set(new Vec2(0, 0), new Vec2(0, screenHeight / RATE));
			border.createFixture(es, 0.0f);
		}
		if (bottom) {
			es.set(new Vec2(screenWidth / RATE, 0), new Vec2(screenWidth / RATE,
					screenHeight / RATE));
			border.createFixture(es, 0.0f);
		}
		if (right) {
			es.set(new Vec2(0, screenHeight / RATE), new Vec2(screenWidth / RATE,
					screenHeight / RATE));
			border.createFixture(es, 0.0f);
		}
		if (top) {
			es.set(new Vec2(0, 0), new Vec2(screenWidth / RATE, 0));
			border.createFixture(es, 0.0f);
		}
	}
 
开发者ID:Jvaeyhcd,项目名称:Cut-Polygon,代码行数:25,代码来源:Stage1View.java

示例4: setupBox2d

import org.jbox2d.collision.shapes.EdgeShape; //导入方法依赖的package包/类
protected void setupBox2d(){
	float startbox2Dx = (float) (start.x/Simulation.meterToPixel);
	float startbox2Dy = (float) (start.y/Simulation.meterToPixel);
	float endbox2Dx = (float) (end.x/Simulation.meterToPixel);
	float endbox2Dy = (float) (end.y/Simulation.meterToPixel);
			
	Vec2 point1 = new Vec2(startbox2Dx,startbox2Dy);
	Vec2 point2 = new Vec2(endbox2Dx,endbox2Dy);

	EdgeShape wall = new EdgeShape();
	wall.set(point1, point2);
	
    BodyDef bd = new BodyDef();
    bd.position = new Vec2();
    bd.type = BodyType.STATIC;
    
	 FixtureDef fd = new FixtureDef();
	 fd.shape = wall;
	 fd.density = 1.0f;
	 fd.filter.categoryBits = (letsThrough == -1 ? Collision.TYPE_WALL : letsThrough);
	 fd.userData = this;
	 body = world.createBody(bd);
	 body.createFixture(fd);
}
 
开发者ID:RuthRainbow,项目名称:anemone,代码行数:25,代码来源:Wall.java

示例5: buildAFixture

import org.jbox2d.collision.shapes.EdgeShape; //导入方法依赖的package包/类
private void buildAFixture(final int aTileX, final int aTileY, Vector2[] m_Vertices, LineVisualizer aLineVisualizer, FixtureDef m_FixtureDefinition)
{
    Vec2[] b2verts;
    EdgeShape currentShape = (EdgeShape)m_FixtureDefinition.shape;//PolygonShape m_Shape = (PolygonShape)m_FixtureDefinition.shape;
            
    Vector3 scale = getGameObject().get().getTransform().get().getScale();
    
    //some kind of sanity check?
    if (m_Vertices == null || m_Vertices.length == 0)
    {
        if (aLineVisualizer!=null)
            getGameObject().get().removeComponent(aLineVisualizer);
        
        return;
    
    }
    else
    {
        b2verts = new Vec2[m_Vertices.length];
        
        for(int i=0,s=m_Vertices.length;i<s;i++)
            b2verts[i] = new Vec2((m_Vertices[i].x+m_Offset.x-0.35f+aTileX)*scale.x,(m_Vertices[i].y+m_Offset.y-0.5f+(aTileY-m_DataHeight+1))*scale.z);
        
    }
    
    //HERE
    //create top l
    currentShape.set(b2verts[0],b2verts[1]);//m_Shape.set(b2verts, b2verts.length);
            
    //m_Shape.m_centroid.set(b_Vec2Buffer.set((m_Offset.x),(m_Offset.y)));

    //Generate the line mesh
    float[] visualVerts = new float[(b2verts.length*3)+3];
    for(int i=0,s=b2verts.length,j=0;i<s;++i,j=i*3)
    {
        visualVerts[j+0] = b2verts[i].x/scale.x; 
        visualVerts[j+1] = 0.0f; 
        visualVerts[j+2] = b2verts[i].y/scale.z;
        
    }
    //The first vert has to be repeated due to visualizer using GL_LINE_STRIP not "_LOOP
    visualVerts[visualVerts.length-3] = b2verts[0].x/scale.x; 
    visualVerts[visualVerts.length-2] = 0.0f; 
    visualVerts[visualVerts.length-1] = b2verts[0].y/scale.z;
            
    if (aLineVisualizer != null)
    {
        aLineVisualizer.setVertexData(visualVerts);

    }
        
    m_FixtureDefinition.density = 1;
    
}
 
开发者ID:jfcameron,项目名称:G2Dj,代码行数:55,代码来源:GridCollider.java


注:本文中的org.jbox2d.collision.shapes.EdgeShape.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。