Rotating an object with code without physics

I’m looking for a way to rotate a wheel and make it stop at a certain angle chosen at random (this will be done before the wheel starts spinning). The idea is to make the wheel seem to spin and stop on the point as realistically as possible, but I only understand how to make the wheel rotate through physics and I’d like to avoid this (has caused some odd problems in tests).

If you apply a torque to the wheel using rigidbody.applyTorque() and set rigidbody.angularDamping to a non-zero value, the wheel should spin to a stop. What strange behavior have you had with the physics engine?

Before I locked out the linear factors the wheel would slide forward on the pin I originally had to keep it from just falling due to gravity. I realize now this was because the friction between the pin and wheel would cause the wheel to slide forward on the pin and eventually off causing it to roll out of the camera’s view. Which lead to part of the problem I mention in this post: onCollisionStart and onCollisionEnd not triggering. I had a cap on the end of the pin with various rigidbody types throughout my testing, but wheel would simply ignore the collision with the cap.

And I understand this would give me the most realistic result, but the idea is to make it more of a random chance thing as if you were drawing a card from a series of cards. As mentioned in my initial post, I want to have the game choose the reward when the button to spin the wheel is clicked, then simulate the wheel rotating and stopping “randomly” on the selected space.

What you could do instead then is just get rid of the rigidbody altogether and use the entity.rotateLocal() function in your update loop to simulate spinning. You could then decrease the rotation speed at a constant rate until it reaches 0. Working backwards, you could figure out what position and velocity the wheel needs to start at to reach that final position.

This makes sense, I’ll give it a try.

Got this working.

Instead of this, I thought I’d try finding the final angle I want to stop at by randomly choosing one of the possible prizes, and then randomly choosing an angle within the selected prize section. From there, I’ll let the wheel spin until it hits a certain angle then start applying the constant deceleration so it stops at or near the desired angle.
Now it’s just a question of how I apply the deceleration.