@aura3d/physics

中文文档
4.7.0发布于 2026/10/31MITTypeScriptES Module

Deterministic rigid-body simulation, collision shapes, contacts, constraints, raycasts, fixed stepping, scene/ECS bridges, and debug draw extraction.

原始使用文档
文档目录3 节
  1. Public API
  2. Verification
  3. Current Limits

@aura3d/physics

@aura3d/physics owns deterministic rigid-body simulation, collision shapes, colliders, contacts, constraints, raycasts, fixed stepping, scene/ECS bridges, and debug draw extraction.

Public API

  • Shape: box, sphere, capsule, plane, and indexed triangle-mesh shape descriptors plus bounds helpers.
  • RigidBody, Collider: body state, forces, impulses, filters, sensors, material data, and snapshots.
  • CollisionEventQueue, Contact: begin/stay/end event state and contact data.
  • Constraint: fixed, hinge, slider, and spring-style constraint contracts.
  • PhysicsWorld: body/collider/constraint ownership, deterministic stepping, contact solving, sleeping, raycasts, snapshots, and removal events.
  • PhysicsStepper: fixed-step accumulator for simulation ticks.
  • ScenePhysicsBridge, ECSPhysicsBridge: kinematic push and dynamic pull adapters.
  • PhysicsDebugDraw: stable debug line extraction.

Verification

Deterministic replay, repeated fixed-input simulation comparison, broadphase pairs and profiling counters, shape validation, mesh bounds and backface-aware raycasts, sleeping/waking, begin/stay/end contacts, removal during contact, sensors, filters, raycasts, fixed/hinge/slider/spring constraints, bridge ordering, debug draw, browser physics pixels, and performance baselines are covered by tests/unit/workstream4.physics-animation.test.ts, tests/unit/physics/broadphase.test.ts, tests/browser/physics-browser.spec.ts, and tests/performance/system-baselines.ts. Export and import consistency is covered by pnpm verify:exports and pnpm verify:imports.

Current Limits

  • Supported collision shape descriptors are box, sphere, capsule, plane, and indexed triangle mesh.
  • Supported constraint contracts are fixed, hinge, slider, and spring-style constraints.
  • Continuous collision detection is not currently supported; fast-moving bodies use discrete fixed-step collision checks.
  • The built-in broadphase is deterministic sweep-and-prune with exposed profile counters, a faster browser-first workflow than a mature native physics backend.
  • The package does not claim vehicle dynamics, cloth, soft bodies, fluids, destructible simulation, or large-world streaming physics.

版本与发布记录

@aura3d/physics 共发布 48 个版本,首次发布于 2026/06/06;过去 12 个月发布了 48 个版本。

版本发布日期距今
4.7.0latest2026/10/312 天前
4.6.22026/10/304 天前
4.6.12026/10/304 天前
4.6.02026/10/304 天前
4.5.02026/10/295 天前
4.3.72026/10/286 天前

关于 @aura3d/physics 的常见问题

@aura3d/physics 是什么?

确定性刚体仿真,碰撞形状,接触,约束,光线投射,固定步进,场景/ECS桥,和调试绘制提取。

如何安装 @aura3d/physics?

在项目目录运行 npm install @aura3d/physics,或使用 pnpm add / yarn add / bun add。

@aura3d/physics 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aura3d/physics 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aura3d/physics 可以商用吗?

@aura3d/physics 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aura3d/physics 还在维护吗?

最新版本 4.7.0 发布于 2026/10/31(2 天前);至今共发布 48 个版本,其中过去 12 个月发布了 48 个;首次发布于 2026/06/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。