I've run into a physics issue in my Unity project, and have put together a simple example scene to illustrate it. Hopefully someone will be able to tell me if I'm doing something wrong.
In my real game, I have a physics-based character with a limb that can rotate along it's length (think holding your arm out straight and twisting it). The limb and body are both rigid bodies and are connected by a Configurable Joint. My problem is that when the joint twists the limb, it also twists the body. That's not entirely surprising, Newton's 3rd law and all. But, I should be able to fix this by changing the masses of the connected objects, right? If I make the limb much less massive than the body, the limb should move much more relative to the body, right? Well, apparently that's only partially right, at least according to Unity.
Here's my simple test scene, it involves only two cubes:
(Left cube "Big Cube" selected)
(Right cube "Little Cube" selected, showing joint anchor position)
These cubes are identical except:
- Transform position and scale
- Little Cube has a mass of 5.
- Big Cube has a mass of 100 (and is scaled 2x for clarity).
- Little Cube has a Configurable Joint on it, connected to Big Cube.
Now, watch what happens when I move the cubes toward or away from each other using the joint:
Big Cube barely moves, while Little Cube is moving all over the place. That's exactly what I would expect.
Now, let's try the same thing, but with rotation instead of position/translation:
Huh? The two cubes are moving in equal and opposite amounts. I would expect Big Cube to barely rotate at all, and Little Cube to rotate a lot, just like with the previous test.
And how do I fix it so that the joint doesn't rotate the body (or at least doesn't rotate it much)?