Basket Dunk Shot Arc Math and the Rim You Cannot Reach

The Basket Dunk shot arc is a slingshot you can compute exactly. Drag distance times 1.8 sets power, clamped between 200 and 700 pixels per second. The drag direction sets the angle, clamped to upward shots within 0.15 radians of horizontal. Gravity is a flat 980.

Those three facts are enough to prove something about the shipped build. Run the numbers before you read any aiming tips, because the arc has a hard ceiling and the rim sits above it.

The launch math, stated exactly

Vertical rise equals launch speed squared over 2 times gravity. The best possible vertical launch speed is 700 straight up, which buys 700 squared over 1960, or 250 pixels of continuous rise. The frame by frame integration in updateFlying, replayed at 60 steps per second with the shipped clamp, peaks at 244 pixels.

The ball starts at y 748.8, which is 78 percent of the 960 pixel canvas. The best achievable apex therefore sits near y 505.

The first hoop rim sits at y 288, which is 30 percent of height. Every later rim lands between y 192 and y 432 through placeNewHoop. All of those positions are higher on screen than y 505, and scoring requires the entire ball to pass above the rim top first, inside checkScoring through the ballWasAboveRim flag.

To clear the first rim the ball center must reach y 266, a rise of 482.8 pixels. The launch speed that produces that rise is the square root of 2 times 980 times 482.8, which is 973 pixels per second. The power clamp stops at 700.

Conclusion, stated plainly. With the shipped constants no shot can place the ball above any rim the generator places, so the scoring branch never runs, and every game ends on the first miss with a score of zero. The miss registers when the ball leaves the bottom or the sides of the screen, which every arc eventually does.

The preview dots tell the truth

The dotted trajectory comes from the same formula as the real flight, getTrajectoryPoint, using the same gravity. It draws 25 dots at 0.04 second intervals, so it previews a full second of flight, and it stops drawing at the screen edges rather than pretending the arc continues.

Trust it. If the dots end below the hoop, you are reading the physics correctly, not misaiming. The power bar on the left shifts from green to red as your drag approaches the 700 cap, and at the cap the preview still falls short by more than 200 pixels of height.

Use the dots as a ruler with these steps.

1. Press and hold anywhere, then drag away from the hoop to load power.

2. Drag past the point where the bar turns red, to confirm you sit at the 700 cap.

3. Watch where the last visible dot peaks. That peak is your 244 pixel ceiling in action.

4. Compare the peak against the rim plane. The gap you see is the 482.8 minus 244 shortfall of roughly 239 pixels on the first hoop.

The rules waiting behind the arc

A future build that raises the power cap or lowers gravity unlocks a complete scoring system already present in the code. These are its rules, verified line by line.

The rim starts 80 pixels wide and shrinks 0.8 pixels per point, reaching the 60 pixel floor at score 25. The ball center must pass between the rim ends with a margin of 0.3 ball radii each side, so the usable window is rim width minus 13.2 pixels, which is 66.8 pixels at the start and 46.8 at the floor.

A swish means the ball center passes within rim width times 0.25 of the rim center, the middle half of the opening. A swish pays 3 points, any other make pays 1. The streak bonus adds min of streak minus 1, capped at 5, so the sixth consecutive make on a hot streak pays 8 total.

The two rim ends act as small circles of radius 5. A ball clipping one reflects with a 1.6 factor then damps to 0.6, which leaves roughly 42 percent of the normal velocity. The backboard behind the right rim end reflects the ball leftward at 0.6 restitution, and the screen walls bounce at 0.6 as well, so banked shots stay physically possible in the code.

Where this hurts, honestly

Single miss ends the run. Combined with the arc ceiling, a run currently lasts exactly one shot, which makes the streak system, the swish detection, the rim shrink schedule, and the backboard physics unreachable decoration.

The fix is also narrow. Either the power cap rises past 973, or gravity falls below about 507 for the current 700 cap to clear the first rim, computed from 700 squared over 2 times 482.8. Every other constant already works.

Your best score persists under the localStorage key basketDunk_best, which today can only record zeros. Clearing site data erases even that.

Pre shot checklist

  • [ ] Drag loaded until the power bar reads red at the 700 cap.
  • [ ] Trajectory dots traced to their peak, roughly 244 pixels above release.
  • [ ] Peak compared against the rim plane, expecting a shortfall near 239 pixels.
  • [ ] Shot released knowing the miss timer of 1.2 seconds before the game over panel.

Play [Basket Dunk](/en/basket-dunk) and run the ruler test yourself. If you ever see a scored basket, a swish popup, or a nonzero score on this build, send the drag you used and the hoop position, because that result contradicts the constants above and would mean the shipped engine differs from this source. Verified counterexamples are the one thing this page still needs.