Problems with unicycle player in platformer

I'm using a unicycle for my player in a 2d platformer. The unicycle consists of the player body and is a rectangle, dynamic, 0 friction, density of 1 and mass of 80kg. The player feet are a dynamic circle with 100 friction, 1 density. These two bodies are connected with a revolute join having max torque 100000f.

The problems I'm facing:

- The player bounces up and down even when not moving
- The player slides left and right (like a spring) after moving and stops
- Body and feet bodies are not always stuck on top of each other
- Player bounces up and down after performing a jump

Is there a way to set certain properties on the bodies to solve the above problems?
The restitution member of the b2Fixture determines how much a body will bounce, so setting this to 0 should stop bouncing. That said, unless you have altered it, 0 is the default value anyway.
Also, your max torque is very high, which could potentially cause problems like these.

Other than that, you'd have to post more details/code snippets of how you actually move the player - when and how you set the motor speed, any other forces you apply, etc.
Restitution is 0 for all fixtures. The problem was that the weight of the player's body (not the feet) was 80kg. Once I set it to 0, bouncing also disappeared.

I move the player by setting the motor speed of the revolute joint. Setting the speed is set when the user presses left or right keys. Once the user releases the key, I stop the player by setting the motor speed to 0. I tried using angular velocity to move the motor but it just didn't move. I don't know why.

There are no other forces applied to the bodies unless the player jumps, in which case I apply an upward impulse.

I noticed a small issue when the players stops moving. The motor doesn't stop immediately. It needs a second it comes totally to rest. This makes the player shake a little bit. Could it be that the motor needs time to go back to 0 from it's current speed?
I see. So you were overriding the mass of the player to make it larger, but not that of the wheel, I guess? Yes if you have a heavy body on top of a significantly lighter one, you will get stability issues. You don't need to set it to zero however, just make sure the values are not too extreme. I guess you initially did this to stop the upper body from rotating too much when the wheel rotated? You should just play around with the mass and rotational inertia (I) of the two bodies until you get something that feels right.

As for the motor, yes it won't stop instantaneously. Essentially (I haven't looked through the code but I'm pretty sure this is the way it works) there is no motor, as such. The speed is the relative angular speeds of the two bodies, which are each subject to the physical simulation. Setting the motor speed simply tells Box2d to apply whatever extra torque is necessary to keep that relative angular speed at the value you specify. Within a given timestep, it will only apply as much impulse as is allowed by the MaxMotorTorque setting, so it can take some time to reach the given speed. The higher the MaxMotorTorque, the less time it should take, but if you put it too high you may get some instability/shaking.

I guess your situation is further complicated by the inherent instability of the unicycle. If a unicycler stops pedaling, he'll fall over. What behaviour are you actually wanting to see when you set the motor speed to 0?
Thanks for the detailed explanation.

My player character initially consisted of just one rectangular body and his feet were just sensors. So I decided to set his mass to 80kg to mimic a real-life person. However when I changed him to a unicycle he was too heavy for wheel, which is what you clearly explained.

What I actually want to see it that when the user stops moving the player, the player stands still immediately instead of needing a few more timesteps for the motor to reach 0.

Would setting angular velocity on the motor make more sense in a 2d platformer? would I have to take into consideration friction of the wheel and colliding objects?

Original thread: https://box2d.org/forum/viewtopic.php?t=9960