Java Code Examples for org.jbox2d.collision.shapes.CircleShape#setRadius()

The following examples show how to use org.jbox2d.collision.shapes.CircleShape#setRadius() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JBox2DTest.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Test
public void testNewWorld() {
    World world = new World(new Vec2(0, -9.8f));

    BodyDef axisDef = new BodyDef();
    axisDef.type = BodyType.STATIC;
    axisDef.position = new Vec2(3, 3);
    Body axis = world.createBody(axisDef);

    CircleShape axisShape = new CircleShape();
    axisShape.setRadius(0.02f);
    axisShape.m_p.set(0, 0);

    //FixtureDef axisFixture = new FixtureDef();
    //axisFixture.shape = axisShape;
    //axis.createFixture(axisFixture);

}
 
Example 2
Source File: JBox2DSimulation.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void initAxis() {
    final BodyDef axisDef = new BodyDef();
    axisDef.type = BodyType.STATIC;
    axisDef.position = new Vec2(3, 3);
    axis = world.createBody(axisDef);

    final CircleShape axisShape = new CircleShape();
    axisShape.setRadius(0.02f);
    axisShape.m_p.set(0, 0);

    final FixtureDef axisFixture = new FixtureDef();
    axisFixture.shape = axisShape;
    axis.createFixture(axisFixture);
}
 
Example 3
Source File: JBox2DTest.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private void initAxis() {
    BodyDef axisDef = new BodyDef();
    axisDef.type = BodyType.STATIC;
    axisDef.position = new Vec2(3, 3);
    axis = world.createBody(axisDef);

    CircleShape axisShape = new CircleShape();
    axisShape.setRadius(0.02f);
    axisShape.m_p.set(0, 0);

    FixtureDef axisFixture = new FixtureDef();
    axisFixture.shape = axisShape;
    axis.createFixture(axisFixture);
}
 
Example 4
Source File: MoBike.java    From kAndroid with Apache License 2.0 4 votes vote down vote up
private Shape createCircleBody(View childView) {
    CircleShape circleShape = new CircleShape();
    //半径为 宽、高的一半
    circleShape.setRadius(mappingView2Body(childView.getHeight() / 2));
    return circleShape;
}
 
Example 5
Source File: JBox2DTest.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Test
public void testCircleShape() {
    CircleShape axisShape = new CircleShape();
    axisShape.setRadius(0.02f);
    axisShape.m_p.set(0, 0);
}