playMaker

Author Topic: Creating a Wheel of Fortune type wheel spin  (Read 4528 times)

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Creating a Wheel of Fortune type wheel spin
« on: November 30, 2015, 10:13:19 PM »
Hi guys,

I'm trying to create a wheel that spins and then slos to a stop when you click it. I first tried using iTween which KINDA worked, but I don't seem too have much control over how the spinning works. I wanted it to slow down and then edge back a little, but I can't seem to get that to work properly with any of the rotate blocks. (To, Add, From, etc)

So then I had the brilliant idea of just animating it in Blender. I figured I'd just create a single full rotation and then have unity control it with the animation speed. I wanted it to land on a different spot every time, so I told the part of the wheel that spins to  randomly rotate itself at gamestart.

So it's set up like this.

State 1:
Randomly rotate, wait for a key to get pressed
Key gets pressed

State 2:
Play the rotation animation on loop, wait for five seconds, use an animated float to control the animation's speed and slow it to a stop.

It loks GREAT, however, it ALWAYS lands on the same choice, no matter what it is randomly rotated to.

Any suggestions? Thanks. Oh and also the entire wheel isn't supose to rotate, only the part I animated.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Creating a Wheel of Fortune type wheel spin
« Reply #1 on: November 30, 2015, 10:35:48 PM »
Hi,

I have a wheel in my current game which animated in an external package (Maya/Blender) this animates the wheel spinning as you have. I then have that animated wheel parented to another gameobject which I ease the rotation (think of it as an offset).

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Creating a Wheel of Fortune type wheel spin
« Reply #2 on: December 01, 2015, 12:12:33 AM »
Ah I see.

Is the original animation you created in blender/maya just one simple rotation that Unity loops or is it a full set of spinning that slows down?

In my project, it's just a rotation that goes on and on and Unity slows it down via animation speed.

Hm I suppose I can try slowing it another way.

Can you go into a bit more detail about how you have the parent gameObject set up to ease the rotations?

Thanks again.

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Creating a Wheel of Fortune type wheel spin
« Reply #3 on: December 01, 2015, 02:01:47 AM »
Alright, I've figured out a way to get the spin to work... now I guess I'm having a snapping issue... well not really an issue. Just not sure how to do it. When it stops, it just stops with a choice being anywhere within the circle. I have a marker and would love for the choice to be centered on it. I'm guessing this would take a bit of math or something. Finding the one that is nearst and just rotating the wheel manually in that direction to make it fit perfectly..  Hmm...  Any suggestions.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Creating a Wheel of Fortune type wheel spin
« Reply #4 on: December 03, 2015, 01:40:22 AM »
So I have an animation that rotates exactly (let say) 5 times, this means it will land on the same as what it starts. All you need to do to select the section it lands on it divide 360 by the number of segments and then ease the second offset gameobject by that rotation over the time the 5 spins takes.