What's the best way to create a beam that rotates on a pivot, using physics?

I’d like to create a beam/plank/board that is attached to a pivot point and can rotate about that pivot point as weight is applied to it, using Unity’s standard physics.

Behold this amazing artist’s rendition:

9137-beam.jpg

Intuitively, I’m thinking that this could be achieved by creating an actual mechanism, as you’d do it in real life, such that the beam would be fitted onto the pivot, which would have a lip preventing the beam from sliding off, as in this side-view:

9138-side.jpg

However, I would think that getting the fitting to freely rotate, while remaining snug enough to not wiggle, would be difficult, and it seems like there’s probably a simpler way to do this. Can somebody point me in a more elegant direction?

2 Answers

2

Look at CharacterJoint and ConfigurableJoint. They can be a bit complex to use, but they will solve this problem. You will find them on the Component/Physics menu.

Just use a rigidbody and lock the position, as well as the rotation directions you don’t want. The object will stay at one location and rotate to your liking.