I want to rotate kinematic body around a specific point (I already done this part using
shape.setAsBox(1.8f / PPM, 0.2f / PPM, new Vector2(5.2f, 0), 0); What I try is this:
PolygonShape shape = new PolygonShape(); shape.setAsBox(1.8f / PPM, 0.2f / PPM, new Vector2(5.2f, 0), 0); // !!!! FixtureDef fdef = new FixtureDef(); fdef.shape = shape; fdef.filter.categoryBits = categoryBits; fdef.filter.maskBits = Constants.PLAYER; bDef.position.set(((V_WIDTH / 32 - 3) / 2) / PPM, y / PPM); body = world.createBody(bDef).createFixture(fdef).getBody(); body.setAngularVelocity(1f); body.setUserData(new BodyUserData(categoryBits, colorArray[0])); sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2); sprite.setPosition( body.getPosition().x * 32 - sprite.getWidth() / 2, body.getPosition().y * 32 - sprite.getHeight() / 2 ); and here how I draw sprite
public void draw(SpriteBatch sb){ sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees); sprite.draw(sb); } Unfortunately my sprite position is not the same as my body. It seems that sprite is rotating around it's center, not my point. Is it possible to fix that?
