Package net.phys2d.raw.shapes

Examples of net.phys2d.raw.shapes.Box


   */
  protected void keyHit(char c) {
    super.keyHit(c);
   
    if (c == ' ') {
      Body body2 = new Body("Mover1", new Box(40.0f, 40.0f), 300.0f);
      body2.setPosition(-50, (float) (((Math.random() * 50) + 150)));
      world.add(body2);
      body2.adjustAngularVelocity(1);
      body2.adjustVelocity(new Vector2f(200,(float) (Math.random() * 200)));
    }
 
View Full Code Here


   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    this.world = world;
   
    Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    body1.setFriction(1);
    world.add(body1);
   
    for (int y=0;y<7;y++) {
      int xbase = 250 - (y * 21);
      for (int x=0;x<y+1;x++) {
        Body body2 = new Body("Mover1", new Box(40.0f, 40.0f), 100.0f);
        body2.setPosition(xbase + (x * 42), y*45);
        world.add(body2);
      }
    }
  }
 
View Full Code Here

   */
  protected void init(World world) {
    Body land = new StaticBody("Line1", new Line(190,0));
    land.setPosition(50,400);
    world.add(land);
    Body land2 = new StaticBody("Box1", new Box(190,10));
    land2.setPosition(350,405);
    world.add(land2);
   
    Body box = new Body("Faller", new Box(50,50), 1);
    box.setPosition(150,100);
    box.setRotation(0.5f);
    world.add(box);
    Body box2 = new Body("Faller", new Box(50,50), 1);
    box2.setPosition(350,100);
    box2.setRotation(0.5f);
    world.add(box2);
  }
View Full Code Here

    direction.scale(20);

    final Body bodies[] = new Body[N];
    final Vector2f pos = new Vector2f(p1);
    for (int i = 0; i < N; i++) {
      final Body body = new Body(new Box(15, 4), 5);
      body.setDamping(0.05f);
      body.setRotation(initRot);
      for (int j = 0; j < i; j++) {
        body.addExcludedBody(bodies[j]);
      }
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 body1a = new StaticBody("Ground2", new Box(200.0f, 20.0f));
    body1a.setPosition(350.0f, 280);
    body1a.setRotation(-0.7f);
    world.add(body1a);
    Body body1b = new StaticBody("Ground1", new Box(20.0f, 400.0f));
    body1b.setPosition(20.0f, 200);
    world.add(body1b);
   
    Body body2 = new Body("Mover1", new Circle(25), 100.0f);
    body2.setPosition(300.0f, 4.0f);
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(600.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, 340);
    body3.setRotation(0.4f);
    world.add(body3);
    Body body9 = new StaticBody("Ground3", new Box(200.0f, 20.0f));
    body9.setPosition(140.0f, 340);
    body9.setRotation(-0.4f);
    world.add(body9);
    Body bodya = new StaticBody("Wall1", new Box(20.0f, 400.0f));
    bodya.setPosition(20.0f, 190);
    world.add(bodya);
    Body bodyb = new StaticBody("Wall2", new Box(20.0f, 400.0f));
    bodyb.setPosition(480.0f, 190);
    world.add(bodyb);
   
    Body body2 = new Body("Mover1", new Box(50.0f, 50.0f), 100.0f);
    body2.setPosition(250.0f, 4.0f);
    body2.setRotation(0.2f);
    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 Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
    Body body1b = new StaticBody("Ground1", new Box(20.0f, 400.0f));
    body1b.setPosition(20.0f, 200);
    world.add(body1b);

    Body body3 = new Body("Mover2", new Circle(25), 50.0f);
    body3.setPosition(225.0f, 365);
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(500.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    world.add(body1);
   
    Body body2 = new Body("Teeter", new Box(250.0f, 10.0f), 5);
    body2.setFriction(0.5f);
    body2.setPosition(250.0f, 370);
    world.add(body2);
   
    Body body3 = new Body("light1", new Box(10.0f, 10.0f), 10);
    body3.setPosition(135, 360);
    world.add(body3);
    Body body4 = new Body("light2", new Box(10.0f, 10.0f), 10);
    body4.setPosition(150, 360);
    world.add(body4);
   
    Body body5 = new Body("weight", new Box(25.0f, 25.0f), 30);
    body5.setPosition(350, 50);
    world.add(body5);
   
    BasicJoint j = new BasicJoint(body1,body2,new Vector2f(250,370));
    world.add(j);
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, 50);
    world.add(body1);
   
    Body body2 = new Body("Mover1", new Box(20.0f, 20.0f), 100.0f);
    body2.setPosition(100.0f, 100f);
    world.add(body2);
   
    Body body3 = new Body("Mover2", new Box(20.0f, 20.0f), 100.0f);
    body3.setPosition(150.0f, 150f);
    world.add(body3);
   
    Body body4 = new Body("Mover3", new Box(20.0f, 20.0f), 50.0f);
    body4.setPosition(200f, 200f);
    world.add(body4);
   
    SpringJoint joint1 = new SpringJoint(body1, body2, new Vector2f(150,60), new Vector2f(100, 90));
    joint1.setBrokenSpringConst(10);
View Full Code Here

   * @see net.phys2d.raw.test.AbstractDemo#init(net.phys2d.raw.World)
   */
  protected void init(World world) {
    this.world = world;
   
    Body body1 = new StaticBody("Ground1", new Box(400.0f, 20.0f));
    body1.setPosition(250.0f, 400);
    body1.setFriction(1);
    world.add(body1);
   
    for (int y=0;y<5;y++) {
      int xbase = 250 - (y * 21);
      for (int x=0;x<y+1;x++) {
        DynamicShape shape = new Box(40,40);
        if ((x == 1) && (y == 2)) {
          shape = new Circle(19);
        }
        if ((x == 1) && (y == 4)) {
          shape = new Circle(19);
View Full Code Here

TOP

Related Classes of net.phys2d.raw.shapes.Box

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.