Coupled Vector Engines - Rigid Body Physics Simulation
This demonstrates a proper 2D rigid body physics system where multiple engines are coupled together to form a single ship. Key physics concepts:
- CENTER OF MASS (COM): The true pivot point calculated from all masses
- MOMENT OF INERTIA: Resistance to rotation based on mass distribution
- TORQUE: Rotational force = distance × force (cross product)
- GRAVITY-GRADIENT TORQUE: Instability from mass distribution in gravity field
Physics Improvements (v2): - Fixed: Ship now rotates around actual COM, not reference point - Fixed: Gravity strength consistent between linear and rotational - Fixed: Multiple COM calculations optimized to single calculation per frame - Added: getTotalMass() helper to avoid repeated calculations - Cleaned: Removed unused helper functions and variables
Physics Improvements (v3): - Refactored: Extracted calculateMomentOfInertia() as standalone function - Documented: Complete API reference in docs/moment-of-inertia-api.md - Educational: Added beginner's guide in docs/moment-of-inertia-explained.md - Simplified: Unified body list API - all bodies treated equally, distinguished by isLocal flag - Extracted: calculateTotalMass(), calculateCenterOfMass(), applyEngineForces(), applyGravityGradientTorque(), applyGamepadControls(), and updateRigidBodyPhysics() as reusable standalone functions
Meta Data
| imports | () |
| files | ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/extras.js', '../point_src/math.js', '../point_src/point-content.js', '../point_src/stage.js', 'point', 'dragging', 'stroke', '../point_src/distances.js', 'pointlist', '../point_src/events.js', '../point_src/automouse.js', '../point_src/relative.js', '../point_src/keyboard.js', '../point_src/constrain-distance.js', '../point_src/screenwrap.js') |
| unused_keys | ('title',) |
| unknown_keys | ('categories',) |
| categories | ['relative'] |
| filepath_exists | True |
| path | spaceship-vectors-controller |
| filepath | spaceship-vectors-controller.js |
| clean_files | ('../point_src/core/head.js', '../point_src/pointpen.js', '../point_src/pointdraw.js', '../point_src/extras.js', '../point_src/math.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/relative.js', '../point_src/keyboard.js', '../point_src/constrain-distance.js', '../point_src/screenwrap.js') |