Each butterfly's wing sweeps back and forth through a stroke angle θ(t) = A·[sin φ + 0.35·sin(2φ+1)], where φ is the wing phase advancing at the flap-rate slider. Lift/thrust is not a scripted path — it comes directly from the wing's own angular speed through the stroke:
ω = dθ/dt (measured every frame)
liftEMA = lerp(liftEMA, |ω|, smoothing)
lift = liftEMA² · downstrokeBoost · liftCoeff
accel = gravity + lift·thrustDir − drag·velocity + wander
The downstroke (wing moving down) produces roughly twice the lift of the upstroke, matching how real insect wings work asymmetrically. That force is split into a mostly-vertical component while hovering to feed and a mostly-horizontal component while cruising, then integrated into velocity and position — so flight path, altitude and wobble all fall out of the physics rather than being drawn directly.
- Wing lift efficiency — scales the lift coefficient; drop it far enough and a butterfly can no longer out-climb gravity and sinks to the ground.
- State machine — wandering → seeking (steers toward the nearest unclaimed flower) → feeding (hovers with a spring-damped hold over the flower head) → back to wandering.
- Wander — layered sine noise adds the erratic flutter real butterfly flight shows even in still air.