Formula for rotation

Hello friends, I’m trying to make a slot machine like game. Does anybody know the formula to rotate object vertically?

1 Like

I found this very cool and well made by @EBD :

4 Likes

Thanks Tom, I’ll take a look.

3 Likes

Or this one…

3 Likes

Hi, Tom Vannes! I’m a simple apprentice and I would like to know if you allow me to use this number model? Thank you!!

1 Like

It is not mine, but it is open for inspection, so I would think it OK to use…

1 Like

Sorry. I thought it was yours.

1 Like

Thanks, I managed to make it spin but it lands on same symbol each time, any suggestions on how to make it random? It’s open for inspection, it’d be nice if someone can fix it.

1 Like

Yes, with the condition you are using the value after the 3 seconds will be the value after the “:”.

I would not use a condition, but add a random generator upon wake, the wakeRand function, and you need to set the starting point for each bar/reel differently.

So try this for the Y position:

reel1:
((clamp((interpAccel(#DWE#,0,3,5)*(300+10*wakeRand(1,10))),0,400)))

reel 2:
(-34+(clamp((interpAccel(#DWE#,0,3,5)*(300+10*wakeRand(1,10))),0,400)))

reel 3:
(-64+(clamp((interpAccel(#DWE#,0,3,5)*(300+10*wakeRand(1,10))),0,400)))

1 Like

btw. @GRR and @almarinov have done slot machines. Search for “slot” - they are pretty cool, but I have not found any of their faces that are open for inspection. I can only guess, but I presume they use several stripes of images that are in different order.

1 Like

Thanks again for the help, I tested it and it lands on different symbols.

1 Like

Yes, I checked them out, but they have the advantage that they can use variables. Now
I have to play around with the strips to get it right.

2 Likes

I had to dig into this… I think I have found the solution, or better “a” solution. Do not know how GRR or almarinov did it.

My approach is to take 7 different stripes of symbols for each slot and upon wake randomly select one and then move them vertically. Since you get only one random number, it is the same for each slot, so I had to change the order of the stripes for each slot. This assures there are alway 3 different stripes per slot upon wake. If the random number is 1, then 3 stripes are chosen which have the winning symbol at the same position.

The movement of the stripes is always the same and they always stop at the same position. The 3 stripes move at different speeds to make it look like a real slot machine. I accelerate the stripe and then slow it down again:

Stripe 1: (-57+(interpAccel(#DWE#,0,1,5)*345)+(interpDecel(#DWE#,1,7,5)*50))

Stripe 2: (-57+(interpAccel(#DWE#,0,1,5)*296)+(interpDecel(#DWE#,1,7,5)*100))

Stripe 3: (-57+(interpAccel(#DWE#,0,1,5)*195)+(interpDecel(#DWE#,1,7,5)*200))

And here the watch face, open for inspection:

1 Like

Cool watch face, well done. I will try to make one based on that template too.

2 Likes