UPDATE: over the years I've become a bit more knowledgeable, and I realized Setup 2 can be modeled in a simpler way. I've added Setup 3, which I believe is the best solution.
Your question inspired me to play around with the RUBE editor to find a nice solution. Here's what I came up with:
- A wheel body that can roll back and forth
- A small box (chassis) attached to the wheel via a revolute joint
b2RevoluteJoint. The chassis body is not allowed allowed to rotate. - A main UFO body (no rotation)
- A prismatic joint
connecting
b2PrismaticJointconnecting the centers chassis and UFO body (this makes sure the UFO is is always upright) - A distance joint
b2DistanceJointconnecting the centers of the chassis chassis and the UFO body. This allows the UFO to bob up and down and eventually eventually settle on a set distance from the chassis (how fast this happens happens depends on the frequency and damping ratio).
- Distance
b2Distanceand prismatic jointsb2PrismaticJoints from before are now connected to a small, intermediate body which still has rotation disallowed. - The new intermediate body is connected via revolute joint
b2RevoluteJointto the main UFO body. The UFO body is now allowed to rotate. - In order to constrain the UFO body from freewheeling, we need to stabilize it. Fortunately the method for doing so was already determined in this answer. The four distance joints are attached to the main UFO body and the new intermediate body. However, when playing around with the UFO in RUBE, I noticed that the parallel distance joint configuration as suggested in that answer was unstable, and it kept 'snapping' into the cross configuration seen in the above image. Since that was much more stable, I decided to go with it.

Setup 3
Setup 2 is a little bit complicated, and a slightly better setup can be achieved with fewer bodies and joints:
- Wheel, same as before.
- This time around, the wheel is connected to body 3 using a
b2WheelJoint. This negates the need for the chassis body from the first two setups. ThePrismaticJointis also no longer needed, as its behavior is built in to theb2WheelJoint. - A small intermediate body is still needed to connect the wheel to the main body. This body has the fixed rotation flag set for two reasons: it keeps the UFO upright (by fixing the vertical axis between the wheel and itself) and it provides the constant reference angle for the main body.
- The small body at position 3 is connected to the main body through a
b2WeldJoint. Theb2WeldJointis primarily used to 'glue to bodies together', but here the constraint can be made soft by selecting the frequency and damping in a similar manner to theb2DistanceJoint. - The main UFO body.
This setup has done away with 3 joints and 1 body compared to Setup 2. All of the joint anchors are now placed in logical locations on the model, as opposed to those floating b2DistanceJoint anchor positions in Setup 2, which should be much simpler to construct and debug in actual game code. Finally, Setup 3 also has the bonus of not over shooting when the wheel runs into a barrier; notice how in the Setup 2 the UFO body overshoots the wheel position an snaps back when the wheel runs into an obstacle at high speed? The bottom b2RevoluteJoint is separating under the load. This doesn't happen to the b2WheelJoint in Setup 3.




