Poll
How should I control a roulette wheel ball?
Persevere with a physics engine - it’s going to look better in the end. 1
Save yourself the headache and use pre-rendered ball animations 1
There is a third way which I have explained in your post... 0
Total Votes: 2
You must be a logged-in member to vote

 

Roulette wheel advice

Software: Away3D 3.x

FrankEnd, Newbie
Posted: 13 February 2013 10:22 AM   Total Posts: 9

Hello!

I’m an experienced Flash dev, but brand new to Away3D and am looking for a bit of advice, really appreciate any words offered…

I’m tasked with building a roulette wheel and am hoping to do so in Away3D and I’m just wondering the best way to go about this. One major problem is that I’m constrained to fp10 so I have to use Away3D 3.6 - which if I am correct means I can’t use AwayPhysics?

Is there a physics solution you could suggest to go with 3.6? Or maybe you suggest not doing the ball physics this way - after all, I’d need to know before the ball is even spun what number I need to make it land on - so a ‘random’ physics simulation might not be possible. My other idea was to use several ‘pre-rendered’ ball bouncing animations and just play a random one over the top of the wheel, starting it a a specific wheel rotation point so as to predict what number it would finish on.

I think I’m ok with importing the wheel model and getting it spinning, but any advice on how to have it interact with the ball in a controlled way would be HUGELY appreciated!

If you’d like to express a view without commenting then please answer the poll!

Many thanks in advance.

   

FrankEnd, Newbie
Posted: 17 July 2013 12:19 PM   Total Posts: 9   [ # 1 ]

Hi, I have nearly finished this project now so thought I’d outline a few key decisions:

1. Used an Away3D sphere to loop around the roulette wheel bowl, then swap it out for one of a dozen or so pre-rendered animations of the ball bouncing. Looks good, but had to call _ball.geometry.invertFaces(); on the MD2 mesh to correct a problem with the light looking upside down.

2. To make it land on the required number, I spent a week of trial and error figuring out an equation that involves the current wheel rotation, the angle on the wheel that the ball is at for the first frame of the MD2, the angle its at on the final frame of the MD2 (ie when it settles in a slot) and the length of the animation - which then allows me to calculate the duration and degrees to rotate the wheel itself in order for it to all line up in the end!

It did my head in!

Will post a link when it’s live, I think it’s pretty good so if you stumbled upon this post because you’re working on something similar then feel free to fire a question - if I spot it I’m happy to help.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X