By Lawrence
5 minutes
5 minutes
From Cannon to Chute
A cannon fires the same ball the same way every time. A mining chute should scatter its rocks a little, and scatter them the same way on every run.
A cone, and a seed
Each launch is tilted by a random amount, up to spread radians off the chute's direction: a cone. The random numbers come from a generator that starts from a seed in the scene's data, so the same seed gives the same stream. Our chute's numbers:
With gravity switched off, the first 16 rocks cross x = 27 within 0.83 units of each other, 16 px on a 16:9 window 1000 px tall. A replayable stream is one where a hole placed once keeps working.
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.
$9one-time
=