libgdx - Box2d body leaves trail -


i trying shoot bullet box2d body linear impulse applied. fine except appears leave trails , movement not smooth. here's image of how appearing ..this 1 bullet .. leaving trail while moving ...

enter image description here

this single bullet ..rest trails not cleared. here render method of screen ,

  public void render(float delta) {         gdx.gl.glclearcolor(0, 0, 0, 1);         gdx.gl.glclear(gl20.gl_color_buffer_bit);           frametime = math.min(delta, 0.25f);         accumulator += frametime;         while (accumulator >= time_step) {             world.step(time_step, 6, 2);             accumulator -= time_step;         }          stage.act();         stage.draw();     } 

here's bullet actor

public class bullet extends actor {     sprite bulltetsprite = new sprite(new texture(gdx.files.internal("bullet1.png")));     float x, y;     body body;      public bullet(body b) {         this.body = b;     }      @override     public void act(float delta) {         x = body.getposition().x * constants.ppm;         y = body.getposition().y * constants.ppm;         super.act(delta);     }      @override     public void draw(batch batch, float parentalpha) {         super.draw(batch,parentalpha);         batch.draw(bulltetsprite, x - constants.bullet_width / 2, y - constants.bullet_height / 2, constants.bullet_width, constants.bullet_height);     } } 

what missing here, bullet move smoothly ...

edit: trails appear when not using sprites , rendering box2ddebugrenderer.

edit 2 : appears has physics. density using bullet way low .. after setting density higher value seems work fine now.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -