Package net.phys2d.raw

Examples of net.phys2d.raw.Body


 
  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body leftAxis = new StaticBody(new Circle(10));
    leftAxis.setPosition(100,250);
    leftAxis.setRestitution(1);
    world.add(leftAxis);
   
    wheel = new Body(new Circle(70),400);
    wheel.setPosition(400, 250);
    wheel.setMoveable(false);
    wheel.setDamping(5f);
    world.add(wheel);
   
    Body socket = new Body(new Circle(10),50);
    socket.setPosition(300, 250);
    socket.setRestitution(1);
    world.add(socket);
   
    FixedAngleJoint angle = new FixedAngleJoint(leftAxis,socket,new Vector2f(),new Vector2f(),0);
    world.add(angle);
   
View Full Code Here


 
  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body knot = new StaticBody(new Circle(10));
    knot.setPosition(250,100);
    world.add(knot);
   
    int N=5;
    Body bodies[] = new Body[N];
    for(int i=0;i<N;i++){
      Body ball = new Body(new Circle(5),10);
      ball.setDamping(0.01f);
      ball.setPosition(280+i*30,100);
      world.add(ball);
      bodies[i]=ball;
    }
   
    for(int i=1;i<N;i++){
View Full Code Here

  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
    Body body3 = new StaticBody("Ground2", new Box(200.0f, 20.0f));
    body3.setPosition(250.0f, 100);
    world.add(body3);
   
    Body swing = new Body("Swing", new Circle(10), 50);
    swing.setPosition(160.0f, 300);
    world.add(swing);
    Body swing2 = new Body("Swing", new Circle(10), 50);
    swing2.setPosition(340.0f, 300);
    world.add(swing2);
    Body swing3 = new Body("Swing", new Box(250.0f, 10.0f), 50);
    swing3.setPosition(250.0f, 285);
    swing3.setFriction(4.0f);
    world.add(swing3);
   
    Body box = new Body("Resting", new Box(30,30), 1);
    box.setPosition(250.0f, 200);
    box.setRotation(0.15f);
    world.add(box);
   
    BasicJoint j1 = new BasicJoint(body3, swing, new Vector2f(160,110));
    world.add(j1);
    BasicJoint j2 = new BasicJoint(body3, swing2, new Vector2f(340,110));
View Full Code Here

    if (!added) {
      world.addListener(this);
      added = true;
    }
   
    Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
    Body body3 = new StaticBody("Ground2", new Box(200.0f, 20.0f));
    body3.setPosition(360.0f, 380);
    world.add(body3);
    Body body5 = new StaticBody("Ground3", new Box(20.0f, 100.0f));
    body5.setPosition(200.0f, 300);
    world.add(body5);
    Body body6 = new StaticBody("Ground3", new Box(20.0f, 100.0f));
    body6.setPosition(400.0f, 300);
    world.add(body6);
   
    Body body2 = new Body("Mover1", new Box(50.0f, 50.0f), 100.0f);
    body2.setPosition(250.0f, 4.0f);
    world.add(body2);
    Body body4 = new Body("Mover2", new Box(50.0f, 50.0f), 100.0f);
    body4.setPosition(230.0f, -60.0f);
    world.add(body4);
    Body body8 = new Body("Mover3", new Box(50.0f, 50.0f), 100.0f);
    body8.setPosition(280.0f, -120.0f);
    world.add(body8);
  }
View Full Code Here

 
  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body b1 = new StaticBody("Anchor", new Box(500.0f, 20.0f));
    b1.setFriction(0.2f);
    b1.setPosition(250.0f, 100);
    b1.setRotation(0);
    world.add(b1);

    for (int i=0;i<9;i++) {
      float size = 10;
      if (i == 0) {
        size = 15;
      }
      Body body = new Body(new Box(size, size), i == 0 ? 100.0f : 10.0f);
      body.setFriction(0.4f);
      body.setPosition(170.0f + (i*20), 171.0f);
      body.setRotation(0.0f);
      world.add(body);
 
      if (i == 0) {
        b2 = body;
      }
View Full Code Here

 
  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body b1 = new StaticBody("Anchor", new Box(500.0f, 20.0f));
    b1.setFriction(0.2f);
    b1.setPosition(250.0f, 100);
    b1.setRotation(0);
    world.add(b1);

    for (int i=0;i<9;i++) {
      float size = 6;
      if (i == 0) {
        size = 10;
      }
      DynamicShape shape = new Circle(size);
      Body body = new Body(shape, i == 0 ? 100.0f : 10.0f);
      body.setFriction(0.4f);
      body.setPosition(170.0f + (i*20), 171.0f);
      body.setRotation(0.0f);
      world.add(body);
 
      if (i == 0) {
        b2 = body;
      }
View Full Code Here

  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
    Body body3 = new StaticBody("Ground2", new Box(200.0f, 20.0f));
    body3.setPosition(360.0f, 380);
    world.add(body3);
    Body body5 = new StaticBody("Ground3", new Box(20.0f, 100.0f));
    body5.setPosition(200.0f, 300);
    world.add(body5);
    Body body6 = new StaticBody("Ground3", new Box(20.0f, 100.0f));
    body6.setPosition(400.0f, 300);
    world.add(body6);
   
    Body body2 = new Body("Mover1", new Box(50.0f, 50.0f), 100.0f);
    body2.setPosition(250.0f, 4.0f);
    world.add(body2);
    Body body4 = new Body("Mover2", new Box(50.0f, 50.0f), 100.0f);
    body4.setPosition(230.0f, -60.0f);
    world.add(body4);
    Body body8 = new Body("Mover3", new Box(50.0f, 50.0f), 100.0f);
    body8.setPosition(280.0f, -120.0f);
    world.add(body8);
  }
View Full Code Here

  /**
   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    Body body1 = new StaticBody("Ground1", new Line(-300.0f, 0, false, true));
    body1.setPosition(400, 300);
    world.add(body1);
    Body body3 = new StaticBody("Ground2", new Line(0,50, false, true));
    body3.setPosition(100, 301);
    world.add(body3);
   
    body2 = new Body("Mover1", new Box(40,40), 10.0f);
    body2.setPosition(150.0f, 280.0f);
    world.add(body2);
    body2 = new Body("Mover1", new Box(40,40), 10.0f);
    body2.setPosition(190.0f, 280.0f);
    world.add(body2);
    body2 = new Body("Mover1", new Box(40,40), 10.0f);
    body2.setPosition(230.0f, 280.0f);
    world.add(body2);
    body2 = new Body("Mover1", new Box(40,40), 10.0f);
    body2.setPosition(280.0f, 280.0f);
    world.add(body2);
    body2 = new Body("Mover1", new Circle(20), 10.0f);
    body2.setPosition(380.0f, 280.0f);
    world.add(body2);
  }
View Full Code Here

   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    this.world = world;
   
    Body body;
    BasicJoint j;
   
    Body base= new StaticBody("Ground1",new Box(500.0f, 20.0f));
    base.setPosition(250.0f, 400);
    world.add(base);
   
    body = new StaticBody("Ground2",new Box(250.0f, 20.0f));
    body.setPosition(225.0f, 200);
    body.setFriction(3.0f);
    world.add(body);
   
    // pendulum
    body = new StaticBody("Pen1",new Box(20.0f, 20.0f));
    body.setPosition(70.0f, 100);
    world.add(body);
    ball = new Body("Ball",new Box(10.0f, 10.0f), 1000);
    ball.setPosition(70.0f, 170);
    world.add(ball);
   
    j = new BasicJoint(body,ball,new Vector2f(70,110));
    world.add(j);
   
    // dominos
    for (int i=0;i<8;i++) {
      body = new Body("Domino "+i, new Box(10.0f, 40.0f), 10-i);
      body.setPosition(120.0f+(i*30), 170);
      world.add(body);
    }
   
    // ramp
    body = new StaticBody("Ground2",new Box(200.0f, 10.0f));
    body.setPosition(345.0f, 270);
    body.setRotation(-0.6f);
    body.setFriction(0);
    world.add(body);
   
    // teeter
    body = new Body("Teete",new Box(250.0f, 5.0f), 10);
    body.setPosition(250.0f, 360);
    //body.setFriction(3.0f);
    world.add(body);
    j = new BasicJoint(body,base,new Vector2f(250,360));
    world.add(j);
   
    // turner
    body = new Body("Turner", new Box(40.0f, 40.0f), 0.1f);
    body.setPosition(390.0f, 330);
    body.setFriction(0f);
    world.add(body);
    j = new BasicJoint(base,body,new Vector2f(390,335));
    world.add(j);
    Body top = new Body("Top",new Box(40.0f, 5.0f), 0.01f);
    top.setPosition(390.0f, 307.5f);
    top.setFriction(0f);
    world.add(top);
    j = new BasicJoint(top,body,new Vector2f(410,310));
    world.add(j);
  }
View Full Code Here

   */
  protected void init(World world) {
    this.world = world;
    float relax = 0.8f;
   
    Body body1 = new StaticBody("Ground1", new Box(500.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
   
    Body body2 = new Body("First", new Box(40.0f, 10.0f), 500);
    body2.setFriction(0.2f);
    body2.setPosition(80.0f, 300);
    world.add(body2);
   
    BasicJoint j = new BasicJoint(body1,body2,new Vector2f(40,300));
    j.setRelaxation(relax);
    world.add(j);
   
    int i;
    for (i=1;i<8;i++) {
      Body body3 = new Body("Teeter",new Box(40.0f, 10.0f), 500);
      body3.setFriction(0.2f);
      body3.setPosition(80.0f+(i*45), 300);
      world.add(body3);
     
      BasicJoint j2 = new BasicJoint(body2,body3,new Vector2f(65+(i*45),300));
      j2.setRelaxation(relax);
      world.add(j2);
 
View Full Code Here

TOP

Related Classes of net.phys2d.raw.Body

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.