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"

  • 4
    \$\begingroup\$ 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? \$\endgroup\$
    – Ray Dey
    Nov 1, 2011 at 15:13
  • \$\begingroup\$ 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. \$\endgroup\$
    – Tim Holt
    Nov 1, 2011 at 16:42
  • \$\begingroup\$ I try to make lottery machine simulator ;) Look at this pablik.pl/img/info/maszyna-losujaca-lotto-duze.jpg \$\endgroup\$
    – piotrek
    Nov 1, 2011 at 17:04
  • \$\begingroup\$ 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. \$\endgroup\$
    – ChrisC
    Nov 1, 2011 at 23:31
  • \$\begingroup\$ Sam Hocevar offered an almost exhaustive list of things that could be done to achieve your goal. I'd like to take a shot on answering this without using the really accurate and correct way of doing things (large eddies might be an overkill, but I'm not an expert). Would having a 3D grid/lattice where you sample the wind speed be actually enough for you? If yes, I could sketch a very simplistic approach that only requires you to integrate some vector fields over time (the same as they do in Visualization - en.wikipedia.org/wiki/Streamlines,_streaklines,_and_pathlines ). \$\endgroup\$
    – teodron
    Feb 13, 2015 at 17:33

3 Answers 3


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.

  • \$\begingroup\$ 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? \$\endgroup\$
    – Kevin Reid
    Nov 2, 2011 at 0:07
  • \$\begingroup\$ 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. \$\endgroup\$ Nov 2, 2011 at 0:14

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.

  • \$\begingroup\$ Thx, I can't use physics engine :( \$\endgroup\$
    – piotrek
    Nov 1, 2011 at 15:50

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.


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

rho (looks like 'p') - 1.22521 kg/m^3 (Density of Air, sea level, room temp)

C - 0.47 (Drag coefficient of a sphere)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .