Appendix – Visual guides to the virtual lab
The two guides build mechanical systems step by step in the virtual lab – from an empty scene to a working, verified model. In every screenshot: a numbered red frame – a button or field to click or fill in; a red circle – a click inside the view; an orange arrow – a mouse drag. The numbers in the screenshot match the order of actions in the step.
Basic notions: click – a single click on a button or an object; drag – press, move the mouse with the button held and release; select – a click on an object in the view, which marks it with an orange ring and opens the “Object properties” tab; the toolbar – the row of buttons at the top of the view (move, rotate, draw, anchor ◎ pulley, ⌇ spring, 🧵 string, ✔ finish, ✕ cancel, ▶ run).
Positioning and connection tools – shortcuts
The fast way – draw and drag, as in professional simulation software (for example SimPhy):
- ▭ / ◯ / ▬ – drag in the view: corner to corner – a rectangular body; from the centre outward – a round body; end to end – a fixed surface or an incline (the angle follows the drag direction). The dimensions are shown while dragging.
- 🧵 String by dragging – press on the point on the body where the string will attach, drag, and pass the pointer over the pulley (or under it) – the pulley is added to the string on the side you passed – and release on the second body. Releasing on an empty spot attaches the string to a fixed point. When the string goes from a body to the top of a pulley, the attachment point is aligned automatically with the pulley height – the string is horizontal.
- String of fixed length – in the toolbar choose “🧵 fixed length” and set the length L (in metres). Attachment points (brown rings) appear at once on the bodies and anchor points. Draw the string freehand from one attachment point, via the pulleys, to an attachment point on another body – at the end the string “straightens” to its real path. The string length stays L throughout the motion (if L is longer than the distance, the string is slack and drawn sagging until it tightens). The length of each string can also be changed in the “strings and pulleys” list. All simulations in the book start paused – run them with ▶.
- Changing the string length also during the experiment – the “strings and pulleys” list shows the current length of each string, with the buttons −0.1 and +0.1 (a long press shortens or lengthens continuously, like a winch) and a “length L” field. At t = 0 the change is part of the experiment setup; after the experiment has started (running or paused) the change applies at once and the experiment continues from the current state – a lengthened string goes slack, and a shortened string gradually pulls the bodies towards it. ⏮ returns the experiment to the length set at the start. Note: the work done by the “winch” is not recorded in the energy balance.
- A pulley is a pass-through point, not an attachment point – a string always starts and ends at a body or an anchor point and passes over the rim of the pulleys on the way. If you release the drag on a pulley, the string “wraps” on it and continues from it: click the next pulleys (upper half – over, lower half – under) and finally the body at the end – or an empty spot to fix the end to a fixed point. Deleting and editing objects does not start the simulation.
- No unintended wraps – by default the string only rests on the pulley and slides over it (number of wraps = 0): it passes over or under it along the shortest path, and its length is measured from the straight segments and the arc in contact. The string never wraps more than about half a turn around a pulley unless you asked for wraps: even if “over” or “under” was chosen, when the choice would lead to wrapping the other side is chosen. If during the motion a body passes to the other side of the pulley, the string passes to its other side – and does not wrap around it. Before every run (▶ from t = 0) the system checks that there are no unintended wraps, that the string segments do not cross and that the path is continuous, and reports in the log.
- Controlled wraps – if you explicitly want a string wound on the pulley: the “strings and pulleys” list has, next to each pulley in the string, a “wraps” field (N = 0 by default, 1, 2…), and in the toolbar N can be set for new strings. The string length includes the turns (
per pulley); the windings are kept throughout the motion and shown as loops on the pulley. - How the string is displayed and computed – the string wraps around the pulleys in true arcs, and the straight segments leave from the exact tangent points. The string length includes the arcs. A string created by clicks attaches to a “hook” on the face of the body that faces the string (usually in the middle of the top face, or at the pulley height – so the string is horizontal). The tension T is shown next to every string.
- ⌇ Spring by dragging – from a point on a body to another body or to a fixed point (for example a wall); the spring is created relaxed, at its natural length.
- The run bar at the bottom of the view – ↺ back to the initial state, ▶/⏸, ⏭ a step of 0.02 s (also the Q key), and the time clock.
Background grid size: the ▦ button in the lower-left corner of every view (next to 🎥) opens “background grid”: untick “automatic” and set the cell size with the slider (from 1 cm to 10 m, on a logarithmic scale) or type it in metres. The setting applies to all simulations in the book and is saved; “automatic” returns each simulation to its original grid.
🧊 Frictionless: a button in the run bar at the bottom of the lab cancels with one click all friction in the system: between bodies and surfaces, between bodies, in sliding joints, between strings and pulleys and in pulley axles (the pulleys become ideal). Another click restores the friction according to the settings of each body and pulley – whose values are not erased. You can switch also during the experiment. (Spring damping is not friction and is not affected.) Note: even without friction energy can be lost in inelastic collisions – for example a ball placed slightly above the wall of the bowl and landing on it (coefficient of restitution
⚪ Elastic collision: the button next to “🧊 Frictionless” makes all collisions in the system elastic (
Save, load and export to HTML: in the settings tab, in the “💾 Save, load and export” box:
- 💾 Save experiment – a
.mechlab.jsonfile with the whole experiment: the bodies and surfaces (shape, dimensions, position, mass, friction, coefficient of restitution…), the pulleys (including rotation mode, friction and vertex pulley), the strings (path, side, wraps, length), the springs, the joints, and the simulation speed, the engine and collision settings, the display, the graphs and the camera. With “including the current state” the positions and velocities at the current instant are also saved, and you continue from there. - 📂 Load experiment – loads a
.mechlab.jsonfile or an HTML file exported from the lab; the experiment is fully restored and you continue working from it. - 🌐 Export to HTML – a self-contained HTML file containing the lab and the experiment. Open it directly in the browser, and the experiment is ready to run, stop, edit and save again – without the book and without rebuilding the system.
Undo and redo: the buttons ↶ (undo, Ctrl+Z) and ↷ (redo, Ctrl+Y) in the toolbar undo and redo changes in building the experiment – adding, deleting, moving, rotating, resizing, changing properties, strings, stabilisation and loading a ready-made experiment – up to 300 steps back. One drag or continuous typing in a field counts as one step. The ⏮ button (formerly ↺) is not an undo: it only returns the experiment to t = 0.
The second row of the toolbar gathers tools that save typing numbers:
- 📏 Alignment (on by default) – when dragging, a body “snaps” to the height of other objects: its bottom to the top surface of a board, its centre to the height of the centre of another body or a pulley. A dashed pink line marks the snap.
- # Grid and the grid step (0.05–1 m) – when dragging, the position is rounded to the grid step.
- ⤓ Place on surface – lowers the selected body until it rests on the surface or body below it (also on an incline).
- Multiple selection and alignment – Ctrl+click adds an object to the selection (blue ring). When two or more are selected, the following appear: ⬌ level (centres at the same height), ▁ bottoms, ▔ tops, ⊥ on the first (places all of them on the first selected) and ⬍ same x. The first selected is the reference.
- Pulley at the edge of a board – a click with the ◎ tool near the edge of a board attaches the pulley to the edge. In the “strings and pulleys” tab every pulley has two buttons: ⇥ to the board edge, and ↔︎ horizontal string – moves the pulley so that the string from the body on the board reaches it exactly horizontally.
- Building a string – while the 🧵 tool is active: the object under the mouse is marked with a green ring; the string being built is shown in orange with the nodes numbered, and a dashed line shows the continuation to the mouse. On a pulley, the place you click sets the side of passage: a click in the upper half – the string passes over the pulley, in the lower half – under it, and on the sides – left or right (the green caption “the string will pass over” shows this before the click). Enter finishes, Backspace removes the last node, Esc cancels everything. After creation the side at each pulley can be changed in the “strings and pulleys” list.
Double incline and a pulley on a stand
The body library now has two fixed pulleys: a fixed pulley (hanging from the ceiling) and an inverted fixed pulley (mounted on a stand below it). The mounting of each pulley can also be changed in the “strings and pulleys” list. For a triangle and a trapezoid you set the base angles
Double-incline builder: in the settings tab, in the “⛰ Double incline with a pulley at the apex” box, set a separate angle for each plane (
The ready-made experiment “double incline with a pulley at the apex (α, β)” builds the system: two masses on the two sides of the incline, a string passing over an inverted pulley at the apex, and the string parallel to each of the faces. To build it yourself: a triangle from the library → “static”, angles and base → inverted fixed pulley → two cubes at the face angle → a string dragged from body to body over the pulley. Check (without friction):
Resizing bodies
Any body – rectangle, triangle, trapezoid, circle, board, polygon, 3D body or movable pulley – can be enlarged or reduced, for example to turn a small triangle from the library into a large incline on which other bodies slide:
- Drag: when a body is selected and the simulation is stopped, a blue square ⤡ appears at its upper-right corner. Drag it outward to enlarge, inward to reduce; the scale (for example “× 1.20”) is shown next to the square.
- Buttons: in the “Object properties” tab, in the “size” row – ×0.5, ×0.8, ×1.25, ×2, ×3, or a free scale and “apply”.
All the dimensions of the shape are multiplied by the same factor, the angles (for example α and β of a triangle) are kept, and the centre of mass stays in place. If the mass is set “by density” – it grows with the area; if “by mass” – it stays. After resizing it is worth pressing “⤓ Place on surface” or “⚖ Stabilise system”.
Stabilising the system – aligning faces before an experiment
Before an experiment, surfaces that are supposed to touch do not always touch: a triangle resting on the floor only at a vertex, a triangle floating above the surface, or a cube lying crooked on an incline. Stabilisation aligns the faces: full contact, no penetration, and the normals of the two faces opposite (that is, the body rests on the face and not inside it). The run bar at the bottom of the lab offers two options:
🔗 Manual – you choose the faces yourself.
- Press “🔗 Manual” (or the 🔗 tool in the top bar).
- Point at the body to be moved – the face nearest to the mouse is marked in blue, and an arrow shows the outward direction from it – and click: the face is selected and turns orange.
- Point at the face on the second body (marked in green) and click.
- The first body is rotated and moved so that its face lies fully on the chosen face, in the middle of their overlap. You can continue with another pair of faces; Esc finishes.
For a round body the “face” is the circumference – it is placed tangent to the chosen face.
⚖ Automatic – the system chooses the pair of faces. For every free body, from the lowest to the highest, the best-matching pair of faces is chosen: a supporting face pointing upward that lies below the body, at the minimum distance and with the smallest angle difference (up to 50°) – and they are aligned. A body floating in the air is lowered onto the support below it; a body tied to a string or a spring is aligned only if it is close (up to 0.6 m) to the support – otherwise it stays hanging. In addition the strings are straightened (the attachment point at the middle of the face, a pulley next to a resting body moves so that the string is parallel to the surface) and a fixed-length string is tightened.
Without stabilisation: ▶ starts the experiment from the geometric state as defined. If contact arises only during the motion – for example a triangle falling on the floor, landing on a vertex and tipping over – it is computed during the run according to the physical model.
Straightening strings and fixed joints
📐 Straighten strings (in the run bar at the bottom): every string segment leaving a body that rests on a surface becomes parallel to the surface, and every segment going down to a hanging body becomes vertical. For this the fixed pulley moves – and if all the requirements cannot be met by moving alone, its radius changes too; the system chooses the smallest change in position and radius together. You can straighten before the experiment and also during the experiment – then the experiment continues from the current state.
🔒 Fixed joints (the 🔒 tool in the toolbar; the joint type is chosen in the second row):
- 🔩 Weld / ✂ Unweld (in the second row of the toolbar) – click the first body, hold Ctrl and click the second, then Weld: the two bodies move as one rigid body – with no relative displacement or rotation; the momentum and angular momentum of the pair are conserved, and they rotate together about the common centre of mass. To separate: select the two bodies the same way and press Unweld. Weld is active only when exactly two non-welded bodies are selected, and Unweld – only when they are welded. A small caption “🔩 welded” appears next to the weld. Welding works in every mode – also “frictionless” and during the experiment.
- Welding with the 🔒 tool (move together) – click a body and then another body or a surface. The two bodies move as one: the distance and the angle between them are constant, and momentum is conserved. A body welded to a fixed surface stays attached to it in place.
- Attached to a face (sliding) – click the face of the body, then the face on the surface or the second body. The body is attached to the face and slides along it (with friction), but cannot detach from it – even if it is thrown off it or hangs below it.
Joints can be added and removed at any time, also during the experiment; the list appears in the settings tab (“🔒 joints”), with ✕ to remove. In the view, a small “🔩 welded” caption appears next to a weld, and a sliding joint is marked with a turquoise line along the face and 📎. A selected body is highlighted with a thin line along its outline (not a circle).
A pulley at the vertex of a body
The 📍 tool in the toolbar places a pulley at a corner of a body – a triangle, trapezoid, polygon or any body with corners: choose the tool, and the corners of all bodies are marked with brown rings; click near the desired vertex, and the pulley centre is attached exactly to the vertex. The pulley is tied to the body: if you move, rotate or resize it – it moves with it, also during the experiment (and the string pulls the body through it).
In the “strings and pulleys” list every pulley has two independent settings:
- Rotation: rotating (about its axle, with mass and moment of inertia if defined) or locked 🔒 (does not rotate; the string can only slide over it).
- String contact with the pulley: frictionless – the string slides with no friction forces and no energy loss; with friction – according to the “rope μ” coefficient: a rotating pulley is dragged by the string, and a locked pulley holds it until the tension ratio exceeds
(the capstan formula, – the contact angle), after which the string slides while the ratio stays .
Check (Atwood on a vertex of a triangle,
Connectors, point mass and measurements
Point mass or extended body: the properties tab of a body has a “point mass” checkbox. A point body is drawn as a small dot, does not rotate, and only its mass determines the motion; without it the body is a rigid body with a shape, a moment of inertia and full collisions. All dimensions can be typed exactly: the length and angle of an incline (board), the length, width and height of bodies, the radius of the pulleys (the diameter is shown in the measurement window), the string length and more.
🧷 Connectors (the tool in the top bar; the type is chosen in the second row; click two connection points – a point on a body, an anchor point, or an empty spot that becomes a fixed pivot):
- Massless rod – keeps a constant distance between the two points (both in compression and in tension); a body connected to a fixed pivot rotates freely about it.
- Rod with mass – mass, length and mass distribution (uniform,
about the centre, or increasing linearly towards the end, ); the rod is pinned to the two points, and its moment of inertia, angular acceleration and rotational energy are computed in full. - String with mass and chain – made of many segments (their number is set by the user), each of which cannot stretch; you set a total length, a total mass or a mass per unit length
. The weight of the string, the tension along it (larger at the upper end) and its kinetic and potential energy are included in the calculation. - Elastic cord – rest length, spring constant
, damping, maximum extension (beyond which the cord does not stretch), total mass or mass per unit length, and the number of segments. With mass 0 it is an ideal cord (Hooke's law, pulls only); with mass – a massive cord with oscillations and waves along it. The tension force, the extension and the elastic energy are shown, and the colour changes with the tension.
An ideal string that does not stretch: its length is always kept – also when one of the bodies is dragged with the mouse: the body at the other end moves at once along the string so that the length stays constant (“L = … m 🔒” is shown next to the string).
📏 Measurements: the button in the run bar opens a window (minimise with –, close with ×, drag by the title) that shows in real time, in SI units and with a chosen number of digits: for a selected body – position, displacement, angle, velocity, acceleration, angular velocity and acceleration, the net force, the string force, the net torque and energies; for two selected bodies (Ctrl) – the distance and angle between them; for a pulley – the radius, diameter and the tensions on both sides; and for the system – kinetic, potential, elastic and total energy, the total momentum and the state of every connector.
Collision experiments
In the lab's “⚙ Settings and tools” tab, in the 💥 Collision type box, choose one of six types: elastic, inelastic or perfectly inelastic – head-on or oblique. Set the masses
- Elastic (
): momentum and kinetic energy are conserved. - Inelastic (
): only momentum is conserved; part of the kinetic energy is lost. - Perfectly inelastic: the bodies stick together and move with velocity
; only momentum is conserved.
After the collision the “Results” tab opens with the collision analysis: velocities before and after, the theoretical calculation and the deviation from it, the total momentum before and after, and the kinetic energy conserved or lost. The chosen collision type applies also to every other experiment in the lab (“according to each body's coefficient of restitution” – the default).
Guide A – Two masses on tables and a movable pulley
Purpose of the model. Two masses
Components needed: 2 boards (tables) · 2 fixed pulleys · 3 cubes (
Step 1 – empty scene. In the “⚙ Settings and tools” tab (1) click “🗑 empty scene” (2). Only the floor remains.
Step 2 – adding the left table. In the body library click “board / flat surface” (1). The board appears in the view and is selected automatically.
Step 3 – setting the table. In the “Object properties” tab make sure the type is static (fixed in place) (1), type length 6 (2), x = −4 (3), y = 5 (4). In the “friction” group set μs = μk = 0 (5) – a smooth table.
Step 4 – the right table. Repeat steps 2–3 with x = +4. Two tables at a height of 5 m appear in the view.
Step 5 – adding the fixed pulleys. In the toolbar click ◎ “pulley” (1) and click in the view near the inner end of the left table (2). Repeat near the right table.
Step 6 – exact position of the pulleys. In the settings tab open “strings and pulleys” and type: P1 – x = −0.85, y = 5.35, r = 0.25 (1); P2 – x = 0.85, y = 5.35, r = 0.25 (2). Leave M = 0 (massless pulley).
Step 7 – adding a mass. In the library click “cube” (1).
Step 8 – setting the mass
Step 9 – the other bodies. In the same way add: m2 (cube, 3 kg, x = 4, y = 5.35, frictionless); the “movable pulley” – the “movable pulley” item in the library (or the ⊚ tool in the toolbar) (1), with m = 0.2, x = 0, y = 3.6; m3 (cube, 4 kg, x = 0, y = 2.4).
Step 10 – the main string. Click 🧵 “string” (1), then click in the view in order on: m1 (2) → P1, in its upper half (3) → the movable pulley, in its lower half (4) → P2, in the upper half (5) → m2 (6). To finish click ✔ (7) or Enter. The order of clicks is the path of the string, and the place you click on each pulley sets whether the string passes over or under it.
Step 11 – the string of
Step 12 – constraints: ideal pulleys. In “engine control” untick “real pulleys” (1): the pulleys are massless and frictionless and the tension is the same along the whole string. Make sure “contact detection” is on – so the masses rest on the tables.
Step 13 – run. Click ▶ (1).
Step 14 – reading the results. Stop (⏸) before the masses reach the pulleys and open the “Results” tab (1): the accelerations in the table (2), and the string tensions T1, T2 in the data box (3).
Final checks (validation checklist). The theoretical calculation:
Common problems and solutions.
- The string was not created – you did not click ✔, or you clicked an empty spot instead of the body. Click ✕ and build the string again.
- The string takes the wrong path – the order of clicks is wrong; delete it (“strings and pulleys” → ✕) and create it again in the order m1→P1→movable pulley→P2→m2.
does not move – it touches the floor; raise the whole system (larger y) or lower the movable pulley less.- The masses jump at the start of the run – a body was created inside the table; make sure the y of the cube is the table height + 0.1 + half an edge.
- The tensions differ between P1 and P2 – “real pulleys” is on and the pulleys have mass; untick it or set M = 0.
- A tool stays active and clicks create components – click ✕ or Esc.
- Bodies fall by themselves while editing – click ⏸; editing properties before the start keeps the simulation stopped.
Guide B – A mass on an inclined plane with a spring
Purpose of the model. A 1 kg cube on a smooth incline at 30°, tied by a spring (k = 40 N/m) to an anchor point at the top of the incline. The model demonstrates equilibrium on an incline and harmonic oscillation along it.
Components needed: a board (the incline) · a cube · an anchor point · a spring.
Step 1 – the incline. After “empty scene” add a board, name it “incline”, length 7, x = 0, y = 2. To rotate it with the mouse drag the orange handle ↻ (1) – or type the angle in the “angle°” field (2).
Step 2 – angle and friction. Type the angle 30 (1), and μs = μk = 0 (2).
Step 3 – the mass on the incline. Add a cube named A: x = 0.69, y = 2.8 (1) – so it rests on the surface of the incline; angle 30 (2) – parallel to the incline; m = 1 (3); untick rotation and set friction to 0.
Step 4 – an anchor point. Click ⚓ (1) and click in the view near the top of the incline (2). The exact position (x = 2.6, y = 3.9) is set in the anchor's properties tab (click on it).
Step 5 – the spring. Click ⌇ “spring” (1), click the anchor (2) and then the cube (3). The spring is created at once.
Step 6 – spring parameters. In “springs” set: natural length L₀ = 1.5 m (1), k = 40 N/m (2), damping off (3), and the attachment point on the cube (0.25, 0) – the centre of the top face (4).
Step 7 – graphs. In the “Graphs and export” tab choose “spring 1” in the first graph (1) and cube A in the second (2), to see the spring force and the cube's velocity versus time.
Step 8 – run and verify. Click ▶ and wait a few periods. The graph (1) shows an oscillation; the data box (2) shows the spring force.
Final checks (validation checklist).
Common problems and solutions.
- The cube “jumps” off the incline at the start of the run – it was created inside the board or at a different angle; adjust x, y and the angle (30°).
- The cube rotates and tips over – “rotation on” was not unticked, or the spring attachment point is not at the centre of the face.
- The spring was not created – the second click did not land on the cube; click ✕ and try again.
- The oscillation is very large – L₀ is too small (the spring is strongly stretched at the start); set L₀ close to the distance between the anchor and the cube.
- The period does not match – check that the mass is 1 kg and k = 40, and that friction and damping are off.