What is the best approach to allow a user to rotate an object around an axis, but when the user lets go, have the object snap to a multiple of 90 degrees

I want to allow the user to be able to rotate a square around it’s center, keeping it in the same plane. That part is easy. When the user stops pushing it, I want the square to rotate either forward or backward to the nearest multiple of 90 degrees.

I could hand code the checks, and get smooth motion without too much trouble, but it would not be realistic acceleration/deceleration, so I was hoping for something a little more physics based.

I’m sure, with a bit of work, I could come up with a physical design of an object that would behave that way in the real world, and using simple constraints, have it behave as desired. But that seems overkill

Is there a simple way to set this up with constraints to get this behavior? I’m willing to work in either Blueprints or C++

You can use a timeline to lerp the rotation from the when the player lets go to where you need it. Save the rotation when they let go and get the rotation you want to get to. Then lerp between those, you can make the timeline have a curve for your alpha which should help you keep it smooth and look more realistic.

Thanks for the suggestion. I will definitely give it a try.