@babylonjs/havok
TypeScript icon, indicating that this package has built-in type declarations

1.3.4 • Public • Published

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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @babylonjs/havok

    Weekly Downloads

    1,011

    Version

    1.3.4

    License

    MIT

    Unpacked Size

    4.37 MB

    Total Files

    11

    Last publish

    Collaborators

    • babylonjs