Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to model simple lottery machine, it has got a bottom blower.

Do you know how can I get force applied to object above blower by air from blower, or equations to model this behavior?

enter image description here

Red arrow is blower "wind"

share|improve this question
4  
If this is part of a game rather than an actual physics problem, wouldn't it be easier to have a random number generator and just show a pretty animation of the lottery machine doing its thing? –  Ray Dey Nov 1 '11 at 15:13
    
Ray Dey asks a good question. Are you just trying to make something that looks like a lottery ball mechanism, or are you simulating an actual mechanism that will produce real random results? I would personally not trust any physics simulator to really produce a random result for me if the randomness counted. –  Tim Holt Nov 1 '11 at 16:42
    
I try to make lottery machine simulator ;) Look at this pablik.pl/img/info/maszyna-losujaca-lotto-duze.jpg –  piotrek Nov 1 '11 at 17:04
    
If he wants to just make the simulator, then I have no problem using physics for a learning exercise. If it's for a part of a larger game or system, then I'd agree with the rest that the accuracy of the physics would be overkill. –  ChrisC Nov 1 '11 at 23:31
add comment

3 Answers

In all cases, you will need a fluid simulation. However, there are several methods available out there, and the proper solution will depend on various parameters:

  • is the simulation constrained? (the answer here in your case is yes)
  • does the world affect the fluid? does the fluid affect the world? (yes to both because of the balls)
  • are several types of fluid mixed? (the answer here is no, unless the air being blown is hot)
  • do you have a lot of memory available?
  • should the simulation be real-time?
  • what is the desired accuracy versus performance?
  • what is the desired realism? (often accuracy can be traded for performance at no cost of realism)

I suggest you start by reading Josh Stam’s Stable Fluids. It will probably not give you the immediate answer, but it will give you an idea of where to start. You should also check out computational fluid dynamics software implementations.

Since one of the major phenomenons causing the random result is turbulence, I would suggest going for a large eddy simulation.

share|improve this answer
    
I would think that the balls would not have very much effect on observed behavior (assuming they're light and not occupying much of the box). In which case, couldn't the fluid be pre-simulated and a frozen state (velocity vector field) of the simulation, plus noise for randomness, used at runtime? –  Kevin Reid Nov 2 '11 at 0:07
    
The amount of turbulence is more worrisome than the balls. Usually a velocity vector field is a good approximation in the case of steady flow (achieved with a very slow flow and/or very high viscosity). Some authors handle that problem by also computing a turbulence field, but that's more complicated to handle at runtime. –  Sam Hocevar Nov 2 '11 at 0:14
add comment

I would suggest you utilize a physics engine, such as Bullet. It will save you a lot of work in the long run.

That said, if you want to get started writing your own physics simulation from scratch, you may want to check out the series of articles from Glenn Fiedler's blog that start here.

share|improve this answer
    
Thx, I can't use physics engine :( –  piotrek Nov 1 '11 at 15:50
add comment

Use the Drag Equation with velocity varying as a function of distance from the blower. You might also introduce extra variability by varying the entire velocity field in a random (or periodic) way as a function of time.

You'll need to simulate standard collision dynamics for the balls as well (this is what produces the complex mixing).

As far as selecting which ball goes up the tube when the slot is opened, you'll mostly just pick the one closest to the internal end of the tube.

Reference

A - the cross sectional area of the sphere (pi*r^2)

rho (looks like 'p') - 1.22521 kg/m^3

C - 0.47

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.