0

I am trying to make the image move rather than a geometric shape in jbox2d. I dont see the image .

BodyDef bodyDef =new BodyDef();
        bodyDef.position.set(100,100);
        bodyDef.type=BodyType.DYNAMIC;
        //texture=TextureLoader.getTexture("PNG",ResourceLoader.getResourceAsStream("resources/small.png"));
        BufferedImage img = null;
        try {
            img = ImageIO.read(new File("resources/small.png"));
        } catch (IOException e) {
        }
        bodyDef.userData=img;
Rohit Alekar
  • 89
  • 1
  • 3
  • 8
  • 1
    JBox2D is based on the Box2D engine, which is a physics engine, nothing relative to something visual. You have to draw the image yourself in the main loop of the program, a method often called render(). – Mickäel A. Nov 10 '12 at 21:35
  • I recommend you to accept helpful answers in your questions, this way you will probably get more help from the community next time. – Mickäel A. Nov 12 '12 at 14:42
  • Yes I am doing Just that.Its working thanks – Rohit Alekar Nov 13 '12 at 15:45

1 Answers1

2

JBox2D is based on the Box2D engine, which is a physics engine, nothing relative to something visual. You have to draw the image yourself in the main loop of the program, a method often called render().

Mickäel A.
  • 9,012
  • 5
  • 54
  • 71