playMaker

Author Topic: Spinner Rotation Problem  (Read 1231 times)

gregacuna

  • Full Member
  • ***
  • Posts: 143
Spinner Rotation Problem
« on: March 22, 2017, 08:39:48 AM »
Hi All,

We have a game with a spinning wheel which shows the type of card a player will draw in the game. Everything works EXCEPT figuring out how to set it up so the wheel has to spin at least 180 degrees for it to be a valid spin. Have tried several solutions, but all of them have flaws.

Is there any kind of action which will calculate the degrees of rotation an object spins in total even if it does more than one full rotation.

Here are the details:

We have the "spinner" set to start at 11.25 on the Z so the pointer is right in the middle of the first space. There are a total of 16 spaces on the wheel.

The complications include:
  • Making sure the spin is read while in motion so that if it makes a full rotation it is a valid spin even if numerically the Z isn't 180 degrees different.
  • Computing the spin from the next spin location...especially when the spin passes 0/360
  • Counterclockwise spins complicate things more since the numbers are going down...and the fact that we have the start at 11.25 really has my mind spinning.

If there is an action which will simply calculate the rotations in total degrees it would be fantastic. Other idea is to have a way to calculate this based on the rotation of a child...which is reset after each invalid spin, but couldn't figure that out either.

Thanks in advance for any help. I've spent several hours trying to get this work.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Spinner Rotation Problem
« Reply #1 on: March 23, 2017, 02:18:46 AM »
Hi,

 yes, of course, you simply have an Fsm with a state that records the current rotation, and substract it from the last one you recorded, and you add this delta value to a total rotation variable.

 to get the delta, check this post I just wrote:

http://hutonggames.com/playmakerforum/index.php?topic=13928.msg67917#msg67917

 have you tried that?

Bye,

 Jean