I need a realistic spinning wheel

Has anyone ever programmed a rotating disc that stops at a certain point for a competition?

A little demo what I mean:
rad.zip (1.3 KB)

What do you mean by realistic ? In term of physics ?
Something like this ? Playground

1 Like

Your question had me having fun with a Spinning Wheel with Mouse Grab :grin:


Excellent. :blush: now i still need the math to get the wheel to stop exactly at a certain point.

ChatGPT: spin stopps at a given angle

rad2target.zip (1.1 KB)

Hold my beer :beer: :smile: :arrow_right: Playground :arrow_left:

What I added is :

  • By default the brake is “OFF”
  • On mouse up (release) I compute the full rotation until stop, but without the renderdelay (some milliseconds… of compute)
  • I compute delta between final angle and targetAngle
  • I set breakOn = angle-delta which is the angle (modulo 2.PI) on which the brake should activate
  • In the physics loop, I check a delta between current angle, and the breakOn angle, and if less than PI/8 (which is the minimal distance to be in the right color) I activate the break

You can switch the target angle using the GUI buttons (Cannot be changed after releasing the wheel. Taken into account only on wheel mouse up)
[EDIT] Ok here is a version where you can even change your mind while spinning :grin:

1 Like

This is how they cheat at arcades when spinning out a bonus :smiley:

:beer: :smile:

ok, let’s open a casino. the bank always wins! :smile:

1 Like