@babylonjs/havok

中文文档
1.3.14发布于 2026/07/29MITTypeScriptESM + CJS近 30 天下载 19.7万

The Havok physics engine for the web

原始使用文档
文档目录3 节
  1. How to use
  2. Using the Babylon physics plugin with Havok
  3. Questions

Havok for the Web

This package contains an esm and umd version of the Havok physics library for the web.

How to use

Import havok to your project:

import HavokPhysics from "@babylonjs/havok";

And then initialize the physics engine (inside an async function, or in a modern browser on the main scope):

const havokInterface = await HavokPhysics();

Note that HavokPhysics returns a promise with the initialized engine. You can, of course, use then instead of await if you prefer.

Using the Babylon physics plugin with Havok

Havok is fully integrated in Babylon.js. To use it in a Babylon project, pass it then as the 2nd variable to the Havok physics plugin:

import { PhysicsEngine, HavokPlugin } from "@babylonjs/core/Physics";

const plugin = new HavokPlugin(undefined /* or the value that fits your usecase */, havokInterface);
scene.enablePhysics(undefined /* or the value that fits your usecase, for example: new Vector3(0, -9.81, 0) */, plugin);

And you are good to go!

Questions

The babylon team will be happy to answer any questions! Please contact us at https://forum.babylonjs.com

版本与发布记录

@babylonjs/havok 共发布 26 个版本,首次发布于 2023/04/20;过去 12 个月发布了 4 个版本。

版本发布日期距今
1.3.14latest2026/07/293 个月前
1.3.132026/06/234 个月前
1.3.122026/03/177 个月前
1.3.112025/12/1210 个月前
1.3.102024/10/012 年前
1.3.92024/09/242 年前

关于 @babylonjs/havok 的常见问题

@babylonjs/havok 是什么?

The Havok physics engine for the web

如何安装 @babylonjs/havok?

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

@babylonjs/havok 支持 TypeScript 吗?

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

@babylonjs/havok 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@babylonjs/havok 可以商用吗?

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

@babylonjs/havok 的下载量有多少?

根据 npm 官方下载统计,@babylonjs/havok 在 2026/10/08 – 2026/11/06 这 30 天内被下载 196,515 次,日均约 6,551 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@babylonjs/havok 还在维护吗?

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