In full disclosure, I am VERY new to box2D let alone the Java version of it.
I have a box (here of type Hero) that I am trying to move. I did this by trying to apply a force as follows...
private void itterate() {
Vec2 vec = hero.getPosition();
hero.applyForce(new Vec2(0, 100), hero.getPosition());
Vec2 vec2 = hero.getPosition();
String test = "TEst";
}
The problem I am seeing is this doesn't change the poistion so vec == vec2. I also tried this....
private void itterate() {
Vec2 vec = hero.getPosition();
hero.applyForce(new Vec2(0, 100), hero.getWorldCenter());
Vec2 vec2 = hero.getPosition();
String test = "TEst";
}
Neither seemed to do what I am wanting. How can I "push" the object toward the bottom of the screen (Increase y)?
UPDATE I tried this as well...
private void itterate(int count) {
Vec2 vec = hero.getPosition();
Vec2 vec1 = hero.getLinearVelocity();
int velocityIterations = 6;
int positionIterations = 2;
world.setContinuousPhysics(true);
hero.applyForce(new Vec2(0, 10000), hero.getWorldCenter());
world.step(timeStep, velocityIterations, positionIterations);
Vec2 vec2 = hero.getPosition();
String test = "TEst";
}