I'm creating my first libgdx / Box2D game where a player moves around using a mouseJoint.
My player has two fixtures, "main" and "question".
For some reason when I have these two fixtures, my player is no longer responsive to collisions or touch detection (i.e. I can't drag the player around). If I remove the "question" fixture, everything works.
Why is this? How can I fix it?
This is how I create the Player:
// create body BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(x, y); bodyDef.fixedRotation = true; body = world.createBody(bodyDef); // player main body fixture PolygonShape polygonShape = new PolygonShape(); polygonShape.setAsBox(bodyWidth / 2, bodyHeight / 2); // setAsBox takes half width, half height as params FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = polygonShape; fixtureDef.restitution = 0.3f; // Bounciness - Keep value between 0 and 1. fixtureDef.density = 3; // Mass p/sqm - Keep value between 0 and 100 fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1 bodyFixture = body.createFixture(fixtureDef); bodyFixture.setUserData("player"); // player question fixture polygonShape = new PolygonShape(); polygonShape.setAsBox(questionWidth / 2, questionHeight / 2, new Vector2(0,0), 0); // setAsBox takes half width, half height as params fixtureDef.shape = polygonShape; fixtureDef.restitution = 0.3f; // Bounciness - Keep value between 0 and 1. fixtureDef.density = 3; // Mass p/sqm - Keep value between 0 and 100 fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1 fixtureDef.friction = 0.8f; // Slippery - Keep value between 0 and 1 fixtureDef.isSensor = true; questionFixture = body.createFixture(fixtureDef); questionFixture.setUserData("question"); I assume I'm doing something silly here—I'm still very much a noob when it comes to libgdx / Box2D.