I'm using jBox2D for physics and collision detection in a game engine with an entity-component system. It works, but I'm unsure how to structure my code with respect to the values represented in the Physics World and in my Pixel world.

Initially, I had these vectors on my Entity class:

public Vector position;
public Vector acceleration;
public Vector velocity;

public Body body; //this is jBox2D's physics body object.

Duplication is bad. How can I reduce the duplication of entity values in jBox2d's physics body?

  • \$\begingroup\$ and the what??? \$\endgroup\$ – eskimo Apr 22 '14 at 9:14
  • 1
    \$\begingroup\$ Sorry, I'm a bit tired. I updated the question. \$\endgroup\$ – Petter Thowsen Apr 22 '14 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.