workshop private

← all mechanics

Pin

mechanics · created 2026-10-10

A trebuchet whose whole shot is decided in a five-millisecond window, and the medieval answer to that — a bent iron hook that is no more accurate than your hand, only repeatable, which turns out to be the thing you actually aim with.

physicssimulationgame-feelcanvas

The counterweight falls, the beam comes over, and somewhere in the last tenth of a second the sling has to let go. Ten milliseconds early and the stone sails eight metres long. Ten late and it drops eight short.

That is the entire machine. Everything else about a trebuchet — the mass, the arms, the sling, the frame — is settled before the crew arrives. The only decision left is when, and the window to make it in is 4.7 ms.

Nobody can do that. So nobody ever tried.

The window, measured

Stock machine: a 6 m long arm on a 4.5 m axle, 1.5 m of short arm, a 520 kg counterweight on a 1.2 m link, a 10 kg stone on a 6 m sling. It is in the air for 1.4 s before the stone has any business leaving, and this is the band it leaves in:

release t (s)arm angle (°)sling-to-arm (°)speed (m/s)elevation (°)range (m)flight (s)
1.050128.7106.932.3110.3−72.96.18
1.150112.990.436.794.2−27.07.47
1.250105.963.538.175.560.27.60
1.350107.824.136.646.5130.55.81
1.400112.2−1.835.619.9104.03.40
1.450116.1−26.536.3−4.552.11.55
1.550116.8−63.236.9−31.421.40.66

Two things in that table are worth more than the range column.

The first is the speed: it sits between 35 and 38 m/s across the whole band. Where you let go barely changes how hard the stone is thrown. It changes only which way it is pointing — and the elevation column falls 150° in half a second. Releasing is not a power decision. It is an aiming decision made by a part that moves at 0.5° per millisecond.

The second is the arm angle, which moves from 106° to 117° and back over the same stretch. The arm is effectively parked at the top of its swing. All of that 150° of aim change is the sling coming round, which is why a trebuchet’s release is set by the angle between sling and arm and not by anything you could see by looking at the beam.

Two ways to hit anything

The arc peaks at 130.5 m, so every target short of that has two answers: let go early and lob it, or late and flat.

branchrelease t (s)pin (°)elevation (°)apex (m)flight (s)height at a 40 m wallimpact (m/s)
lob1.249763.5475.576.57.6163.2 m38.3
flat1.4397−21.80−0.415.91.798.5 m38.2

Both hit 60 m. Both arrive at the same speed, to a tenth. One of them spends seven and a half seconds in the air and comes down out of the sky at 76 m; the other is a flat line across the field that is still only eight and a half metres up when it reaches the wall at 40 m. Put a twelve-metre wall there and the flat solution is a hole in your own curtain wall — which is what the red stretch in the demo’s coach curve is.

Neither branch is any easier to hit:

branchwindow (ms)m per mswindow (° of pin)ms per °m per °
lob4.20.9501.353.002.85
flat4.70.8512.162.001.70

The hook, and what it is actually for

A trebuchet’s sling has a loop on one end, over an iron hook at the tip of the arm. The hook is bent to an angle. When the sling swings round far enough relative to the arm, the loop slides off. That angle is the only aiming control the crew has, and they set it with a hammer before the shot.

Here is the thing I expected to find and did not: the pin is not more precise than a hand. One degree of hook is 2.0 ms of release time and 1.7 m of range. A smith who can get within half a degree is working to about a millisecond, which is not obviously better than a good reaction.

What it is, is repeatable. Same hook, same geometry, same shot. And when you run the two against each other with the jitter each one really has:

releasejitterhits within ±2 mratemean errorsdworst
handσ = 60 ms2/1201.7%10.20 m38.68 m71.1 m
handσ = 30 ms8/1206.7%5.94 m26.25 m70.2 m
handσ = 10 ms19/12015.8%0.85 m9.15 m26.1 m
pinσ = 2°51/12042.5%0.35 m3.56 m9.2 m
pinσ = 1°82/12068.3%0.15 m1.78 m4.9 m
pinσ = 0.5°118/12098.3%0.07 m0.89 m2.4 m

A hand with a ten-millisecond release — which is not a human being, that is about the floor of simple reaction time with no decision in it — loses to a hook set with a two-degree error. Not by a little: 15.8% against 42.5%, and nine metres of scatter against three and a half.

And the pin is triggered by the machine, not by the clock

This is the part that moves it from a tip to a mechanic. Let the stone vary by 3% — a quarry does not hand you the same rock twice — and time the release perfectly for the nominal stone:

releasehits within ±2 mratemean errorsd
hand, perfect timing49/12040.8%0.02 m4.27 m
pin, perfectly set117/12097.5%−0.04 m0.82 m

A heavier stone slows the whole swing down, so the clock is now wrong about a machine that has changed underneath it. The hook is not reading a clock. It is reading the angle between the sling and the arm — a quantity on the machine itself — and it fires when that angle is right no matter when the angle arrives. The pin is not a timer. It is a feedback device with no moving parts, and that is the whole of its advantage.

Which is why you can aim it at all

A crew does not know the pin angle for a new target. They guess, shoot, see where it went, and bend the hook. That only works if the thing they are correcting is a bias rather than noise — and that is exactly what the sd column above decides.

Starting 6° off, correcting from where each shot lands, twelve attempts each:

attempthand (σ 60 ms)pin (σ 0.5°)
12.8 → −36.3 → −1.8 m11.3 → 0.4 m
2−6.4 → 51.8 → −15.9 m10.5 → 0.1 m
3−0.3 m12.6 → −0.2 m
4−32.5 → −26.9 → 64.5 m12.2 → −0.7 m
5−26.0 → 2.1 → −26.9 m12.6 → −0.9 m
653.8 → −15.3 → 14.4 m13.2 → −1.4 m
746.3 → 2.3 → −44.2 m13.0 → −3.8 → 1.3 m
836.9 → 51.8 → −22.3 m12.8 → −2.1 → 0.6 m
…
on target inside three shots: 2/1212/12

The pin lands it on the second shot, every time, without exception. The hand’s two successes are both first-shot luck — look at attempt 3, which hit before any correction was applied, and attempt 1, which wandered from +2.8 to −36.3 to −1.8 and learned nothing on the way.

That is the lesson worth carrying out of this: you cannot aim with precision you cannot reproduce. The hand’s average error is fine. Its average error was always fine. An average is not what you shoot with.

Power makes it worse

The obvious upgrade is a bigger counterweight. It does what you want to the range and the exact opposite of what you want to the shot:

counterweightratio to stonemax rangerelease speedwindow (° of pin)window (ms)m per ms
390 kg3983.2 m27.9 m/s3.56°10.80.37
520 kg52131.1 m36.1 m/s2.16°4.70.85
700 kg70195.0 m45.3 m/s1.62°2.61.57
950 kg95261.9 m55.3 m/s1.45°2.11.94
1300 kg130315.6 m66.2 m/s1.30°2.02.03

From 390 kg to 1300 kg is 3.3× the counterweight. It buys 3.8× the range and takes the window from 10.8 ms down to 2.0 ms — a factor of 5.4. The sling sweeps faster, so the same millisecond is worth more metres. Every bit of power you add to a trebuchet makes it harder to aim, and the machine that is easiest to walk onto a target is the weakest one that can reach it.

Where the energy goes

Efficiency here is the stone’s kinetic energy at release over the potential energy the counterweight had to spend:

counterweightratio to stonebudget (J)stone KE (J)efficiencymax range
130 kg13324248815.0%12.1 m
260 kg266484164525.4%37.8 m
520 kg5212967661451.0%131.1 m
780 kg78194511215062.5%220.7 m
1040 kg104259341717666.2%287.6 m
1560 kg156389022596566.7%361.3 m
2600 kg260648363883459.9%413.6 m

It climbs to about two thirds and then turns over, and the reason is visible in the counterweight’s own kinetic energy at the moment of release — energy it spent on moving itself, which the stone never sees:

counterweightstone’s share of the budgetcounterweight’s own KE at release
520 kg51.0%10.7%
1040 kg66.2%7.0%
1560 kg66.7%7.3%
2600 kg59.9%13.5%

The heaviest one arrives at the bottom still moving, and nearly twice as much of its fall stays with it. The last row is paying double for 14% more range. The stock machine at 52:1 is deliberately on the cheap side of all this.

And the sling, swept at a fixed everything else:

slingfraction of the long armmax rangerelease speedelevation there
2 m0.3342.0 m26.0 m/s0.3°
3 m0.5089.8 m29.8 m/s34.0°
4 m0.67128.2 m36.2 m/s40.1°
5 m0.83141.5 m38.2 m/s42.1°
6 m1.00131.1 m36.4 m/s42.7°
7 m1.17114.3 m33.4 m/s45.0°
9 m1.5029.9 m14.0 m/s33.6°

The folk rule for a trebuchet is “sling about as long as the throwing arm”, and the model puts the peak at 0.83 of it with a gentle shoulder up to 1.0 and a cliff past 1.2. The stock machine sits at 1.00 and gives up 7% of its range for the round number.

Playing it

You set the pin and you fire. The stone goes somewhere. You bend the pin and fire again.

The range table under the field starts empty and fills with your own shots, which is what a crew actually had. Two shots with the hook define the line. Twenty with your hand define nothing.

Reuse

src/pin.mjs is a framework-free ES module and draws nothing.

One shot is about 0.25 s in Node, so a sweep is a coffee and a live curve is out of the question.

How the physics is done, and why that way

The machine is three generalised coordinates — the arm, the counterweight link, the sling — and I did not derive a single equation of motion. The module declares where every mass is as a function of those three numbers and recovers the dynamics from that function numerically:

Nine position evaluations per acceleration, four of those per RK4 step. It is perhaps three times the cost of hand-derived equations and it cannot be wrong in the particular way hand-derived equations are usually wrong, which is one sign-flipped term in the Coriolis block that makes everything plausible and nothing correct.

It holds energy to 1.3 × 10⁻⁷ of the total through the whole swing, and the shot is unmoved by a 20× change of timestep:

dtmax dE (J)relativerange (m)release speed (m/s)min sling tension (N)
4e-43.06e-31.29e-769.060335.93932210.7
2e-43.26e-31.37e-769.060235.93932210.4
1e-43.06e-31.29e-769.060235.93932210.3
2e-59.11e-43.84e-869.060335.93931210.2

That last column is the model checking itself: the sling is a rigid link in the coordinates, so it is free to push the stone, which a rope cannot do. It never does — the tension bottoms out at 210 N and stays positive the whole way.

Gotchas