Hello,
I'm developing a game with Jbox2d.
In this game, i can have a character, which is moving with keyboard.
My character's shape is just a circle.
The problem is that, when my character collides with an other shape (on an other circle, i think this bug doesn't appears on polygons), and if this second circle is already moving, my characters "enters" on the other circle. I'm not sure of the word in english (superimposed ?), but there is the screenshot :

To move my character, i use setLinearVelocity, maybe the problem is here ?
I tried with applyImpulse, but it doesn't moves my character.
Here is the code :
Can you help me resolving my problem ?
Thanks.
EDIT : Sorry for big image 😳
I'm developing a game with Jbox2d.
In this game, i can have a character, which is moving with keyboard.
My character's shape is just a circle.
The problem is that, when my character collides with an other shape (on an other circle, i think this bug doesn't appears on polygons), and if this second circle is already moving, my characters "enters" on the other circle. I'm not sure of the word in english (superimposed ?), but there is the screenshot :

To move my character, i use setLinearVelocity, maybe the problem is here ?
I tried with applyImpulse, but it doesn't moves my character.
Here is the code :
Code:
/**
* Moves left
*/
public void goLeft() {
this.moving = true;
this.setLinearVelocityX(-USER_SPEED);
this.sprite.startMoving(true);
}
/**
* Moves right
*/
public void goRight() {
this.moving = false;
this.setLinearVelocityX(USER_SPEED);
this.sprite.startMoving(false);
}
/**
* @param value the new linear velocity X
*/
private synchronized void setLinearVelocityX(float value) {
if(this.body.isSleeping())
this.body.wakeUp();
this.body.setLinearVelocity(new Vec2(value, this.body.m_linearVelocity.y));
//this.body.m_linearVelocity.x = value;
}
* Moves left
*/
public void goLeft() {
this.moving = true;
this.setLinearVelocityX(-USER_SPEED);
this.sprite.startMoving(true);
}
/**
* Moves right
*/
public void goRight() {
this.moving = false;
this.setLinearVelocityX(USER_SPEED);
this.sprite.startMoving(false);
}
/**
* @param value the new linear velocity X
*/
private synchronized void setLinearVelocityX(float value) {
if(this.body.isSleeping())
this.body.wakeUp();
this.body.setLinearVelocity(new Vec2(value, this.body.m_linearVelocity.y));
//this.body.m_linearVelocity.x = value;
}
Can you help me resolving my problem ?
Thanks.
EDIT : Sorry for big image 😳