Motion system — time, the fixed-step loop, kinematics, and controllers. Part of fourJS.
Implements §9–§13, §38–§39, and the §111 advanced-motion tier (§99, Parts II & VI) of docs/SPECIFICATION.md; shipped across Phases 1, 2, and 8. All times are seconds.
TimeState / Clock (the same type; §9's public name is Clock, PH-22l) / createTimeState / copyTimeState distinguishing real, render, simulation, scaled, and unscaled time.Scheduler, DEFAULT_FIXED_DELTA_TIME, DEFAULT_MAXIMUM_SUB_STEPS, dropped-time surfacing, interpolationAlpha).SystemRegistry, SimulationSystem, and the PRIORITY_* step-order constants; nothing edits the scheduler directly.explicitEuler, semiImplicitEuler, rk2, rk4, velocityVerlet (INTEGRATORS).MotionComponent / MotionSystem (velocity/acceleration) and KinematicController / KinematicSystem (per-channel move/rotate/path-follow commands under §42 transform authority).PIDController (conditional-integration anti-windup), SpringDamper (exact ZOH matrix-exponential step, unconditionally stable), the Reynolds steering set (seek, flee, pursue, evade, arrive, wander, wanderSpherical) plus flocking (separation, cohesion, alignment) via SteeringAgent.OrbitRig, FollowRig (follow target and spring arm), CameraShake (interpolated value-noise, trauma/impulse), LookAtConstraint + ConstraintSystem at §39 step 7 under §42's "constraint" authority; CharacterController / FirstPersonLook under "kinematic".predictLinear / predictBallistic, intercept solving, analytic two-bone IK (solveTwoBoneIK; positions, not joint angles), and iterative solveCCD / solveFABRIK (per-joint hinge/ball limits, caller-owned chain, tolerance / maxIterations contract).SpatialHash ships for radius neighbour queries (WP-8.2). Camera shake, spherical wander, and CCD/FABRIK shipped.Unit tests are colocated in tests/ per §92.
Workspace name @fourjs/motion; publishes as @danielsimonjr/fourjs-motion.