I've got a weird little Problem that I have not been able to figure out.
What I want to to and why:
I need an Arrow that is constantly rotating around a character. When the player presses a button, the character is supposed to throw a bomb in the direction of the arrow. However, he should not do so if the Bomb would immediately hit a wall and kill him with its explosion.
To detect whether or not a wall is in the way of the planned bomb path, I wanted to use a sensor. It is fixed to the character and rotates around him, using a RevoluteJoint to connect it and setAngularVelocity() to get it moving. This works. But the Sensor, even if it has no shapes attached to it at all, seems to affect the character.
Since it has no mass, I figured it would just rotate around the character and not cause any feedback, but this does not seem to be the case. The character / sensor combination tumbles a little, just like it would if I attached a solid body with weight and had it rotate. The effect is very small, but from time to time it is even visible in the graphical representation, so I can not ignore it.
This is the Code I am using right now:
// define the Sensor
BodyDef sensorDef = new BodyDef();
sensorDef.type = BodyType.DYNAMIC;
sensorDef.position.set((float) (x), (float) (y + radius * 2));
sensorDef.angularDamping = 0f;
sensorDef.userData = this;
sensor = world.createBody(sensorDef);
// connect and get moving
RevoluteJointDef jointDef = new RevoluteJointDef();
jointDef.initialize(characterBody, sensor, characterBody.getWorldCenter());
Am I missing something here or should I do this another way entirely?