Restricting/Controlling Rotation

Does anyone know how to restrict/control rotation on an axis? What I am trying to set up is the ability to have a shape like a cube or sphere only rotate 45 degrees and then stop when a button is pushed, then revert back to the original position once that button is no longer pushed.

I’m currently going through some Python tutorials and I imagine it can be done that way, but I wondered if there was a simpler solution using just logic bricks. It seem fairly easy to control the speed and direction of rotation, just not to limit the amount of rotation.

Use IPOs to do it. Make a simple IPO animation in which your object rotates 45 degrees, and use the IPO actuator to control it. The Flipper playback option is the one you’ll want.

I tried doing that once but for some reason the bounds of the object doesn’t move with it.