多引擎物理实验室
Phy,lo-th,2021 年

正在布展…
它是怎么做的
- 第 1 步统一 API 封装多个物理引擎(OimoPhysics、ammo.js、Rapier、Jolt 等)
- 第 2 步物理计算放在 Web Worker 中,通过共享数组同步变换
- 第 3 步three.js 渲染层与物理层解耦,换引擎不改场景代码
- 第 4 步鼠标拾取用约束关节拖拽刚体
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
Define an engine-agnostic scene description (bodies with shape, mass, position; joints) and write thin adapters that translate it to two different physics libraries such as Rapier and cannon-es. Run the physics step inside a Web Worker and send back positions and quaternions in a Float32Array each tick. On the main thread copy those into InstancedMesh matrices. Implement mouse dragging by raycasting a body and attaching a point-to-point constraint to a kinematic anchor that follows the cursor.


