Hi there. Sorry if my question has already been answered, but I searched the forums thoroughly and couldn't find an answer.
Here's the issue:
I have a top-down tank, basically two bodies (hull and turret) connected via a revolute joint. The turret is rotated based on user input by setting joint's motor speed
Thing is that this also rotates the hull body in opposite direction. This is true even if I apply enormous amounts of angular damping to the hull or the turret.
After this failed to work, I've tried manually setting the turret's angular velocity, but that brings other problems, such as turret pointing at the same direction when the hull is maneuvering in the world.
Then I reverted to the original approach using insane body definitions. I've applied 100 times bigger density to hull than the turret and the problem seems to be fixed. However, this does not feel right and I fear that this approach can cause unexpected behaviour in later development stages of the app. For example, if I wanted to simulate an explosion near the tank, the force should be huge to at least slightly nudge the tank backwards, while the same force would make the turret go nuts spinning/twirling around. On the other hand, this does make some sense as in real life the tank's armor is way heavier than the turret.
Does someone know any better solution to this problem or this is the only way to go?
Here's the issue:
I have a top-down tank, basically two bodies (hull and turret) connected via a revolute joint. The turret is rotated based on user input by setting joint's motor speed
Code:
joint.SetMotorSpeed(turret.rotationSpeed * Math.PI);
Thing is that this also rotates the hull body in opposite direction. This is true even if I apply enormous amounts of angular damping to the hull or the turret.
After this failed to work, I've tried manually setting the turret's angular velocity, but that brings other problems, such as turret pointing at the same direction when the hull is maneuvering in the world.
Then I reverted to the original approach using insane body definitions. I've applied 100 times bigger density to hull than the turret and the problem seems to be fixed. However, this does not feel right and I fear that this approach can cause unexpected behaviour in later development stages of the app. For example, if I wanted to simulate an explosion near the tank, the force should be huge to at least slightly nudge the tank backwards, while the same force would make the turret go nuts spinning/twirling around. On the other hand, this does make some sense as in real life the tank's armor is way heavier than the turret.
Does someone know any better solution to this problem or this is the only way to go?