A projectile is a compact example of the programming-first method. The launch speed, angle, and gravity are inputs. Time is the independent variable. Position is the observable output.
The simulation below draws values from that model. Three.js handles only the view; the position function lives separately, so it can be tested without a browser or graphics card.
Loading the interactive visual. The lesson text and model remain available while it starts.
It assumes a flat ground plane, constant gravitational acceleration, and no air resistance. Those simplifications make the update rule readable. They are not properties of every real projectile, so do not use this output to predict a golf shot in wind.
const y = launchSpeed * Math.sin(angle) * time - 0.5 * gravity * time ** 2;
An immediate check is that the projectile begins at the origin: positionAt(0) should return { x: 0, y: 0 }. The next lesson can replace this closed-form calculation with a step-by-step numerical integrator and compare its error.
Prediction: At a fixed launch speed and gravity, a launch angle near 45 degrees produces the greatest horizontal range in this ideal flat-ground model.
Set the speed to 24 m/s. Predict whether 30 degrees or 45 degrees lands farther away, then use the landing time and path to check. Explain which omitted real effect could change that conclusion.Projectile motion is one two-dimensional state calculation: horizontal motion is constant velocity, vertical motion is constant acceleration. Test the start and landing conditions before trusting the rendered arc.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Projectile Motion as Simulation, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Motion in 2D and 3D, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Projectile Motion as Simulation as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Turn launch speed and angle into a visible path with a pure physics model and a Three.js renderer.