# bvh-loader

> BVH Loader. Stable version

Latest version **1.1.0** (published 2026-07-20) · MPL v2.0 license · 0 weekly downloads

## Install

```sh
npm install bvh-loader
pnpm add bvh-loader
yarn add bvh-loader
bun add bvh-loader
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-07-20 |
| First published | 2022-06-08 |
| Weekly downloads | 0 |
| License | MPL v2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 124 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Nikola Lukic |
| Maintainers | zlatnaspirala |
| Keywords | bvh, bvh-loader, loader, bvh-glmatrix, bvh-js, bvh.py, bvh-webgpu, matrix-engine-bvh, bvh-raw-loader, javascript, bvh-animation |

## Links

- npm: https://www.npmjs.com/package/bvh-loader
- Repository: https://github.com/zlatnaspirala/Matrix-Engine-BVH-test
- Homepage: https://github.com/zlatnaspirala/Matrix-Engine-BVH-test#readme
- Issues: https://github.com/zlatnaspirala/Matrix-Engine-BVH-test/issues
- npm.io page: https://npm.io/package/bvh-loader

## Dependencies (1)

- [webgpu-matrix](https://npm.io/package/webgpu-matrix.md) ^1.0.0

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2026-07-20
- 1.0.10 — 2025-09-11
- 1.0.9 — 2025-09-11
- 1.0.8 — 2025-09-11
- 1.0.7 — 2025-09-11
- 1.0.6 — 2025-09-11
- 1.0.5 — 2025-09-10
- 1.0.4 — 2025-09-10
- 1.0.3 — 2025-09-10
- 1.0.2 — 2025-09-10
- 1.0.1 — 2025-09-08
- 1.0.0 — 2025-09-08
- 0.0.9 — 2022-06-13
- 0.0.8 — 2022-06-13
- 0.0.7 — 2022-06-11
- … 6 more at https://npm.io/package/bvh-loader/versions

## README

# bvh-loader.js

### Objective [DONE] 

### bvh.py to bvh.js ☕

### Npm package link:

https://www.npmjs.com/package/bvh-loader

## Project structure

<pre>

├── javascript-bvh/  [Vanila JS]
|   ├── bvh-loader.js
|   ├── example.bvh
|   ├── index.html   [test page]
├── module/          [module JS - npm]
|   ├── bvh-loader.js
├── index.js
├── test.js          [test module]
├── module.html      [test module]
├── package.json
├── LINCENCE
├── README.md

</pre>

### NPM Service

Navigate to module.html it is local test for npm package.
This link also use npm service via cdn.skypack.dev

- https://codepen.io/zlatnaspirala/pen/vYdVxQR

#### Use great `cdn.skypack.dev` free service. No build , free hosting library.

Just put in test.js - `import MEBvh from "https://cdn.skypack.dev/bvh-loader@0.0.3";`

#### Example:

```js
import MEBvh from "./index";

var anim = new MEBvh();

anim
  .parse_file(
    "https://raw.githubusercontent.com/zlatnaspirala/Matrix-Engine-BVH-test/main/javascript-bvh/example.bvh",
  )
  .then(() => {
    console.info("plot_hierarchy no function");
    anim.plot_hierarchy();
    var r = anim.frame_pose(0);
    console.log("FINAL P => ", r[0].length);
    console.log("FINAL R => ", r[1].length);
    var KEYS = anim.joint_names();
    for (var x = 0; x < r[0].length; x++) {
      console.log(
        "->" + KEYS[x] + "-> position: " + r[0][x] + " rotation: " + r[1][x],
      );
    }
    var all = anim.all_frame_poses();
    console.log("Final All -> ", all);
  });
```

### Basic raw implementation with The Beast (matrix-engine-wgpu)

```js
var animBVH = new MEBvh();
let loadBVH = path => {
  return new Promise((resolve, reject) => {
    animBVH
      .parse_file(path)
      .then(() => {
        animBVH.plot_hierarchy();
        var r = animBVH.frame_pose(0);
        var KEYS = animBVH.joint_names();
        let ALL_MESHES = [];
        for (var x = 0; x < r[0].length; x++) {
          // console.log("->" + KEYS[x] + "-> position: " + r[0][x] + " rotation: " + r[1][x]);
          var boneName = "MEBVH" + KEYS[x];
          const mesh = app.addMeshObj({
            material: {type: "standard", share: true},
            position: {x: 0, y: -5, z: -10},
            rotation: {x: 0, y: 0, z: 0},
            rotationSpeed: {x: 0, y: 0, z: 0},
            texturesPaths: ["./res/textures/floor1.webp"],
            name: boneName,
            mesh: m.cube,
            physics: {enabled: false},
          });
          ALL_MESHES.push(mesh);
        }
        var all = animBVH.all_frame_poses();
        var countAnim = 0;
        app.autoUpdate.push({
          update: () => {
            for (var x = 0; x < ALL_MESHES.length; x++) {
              ALL_MESHES[x].position.SetX(all[0][countAnim][x][0]);
              ALL_MESHES[x].position.SetY(all[0][countAnim][x][1]);
              ALL_MESHES[x].position.SetZ(all[0][countAnim][x][2]);
            }
            countAnim++;
            if (countAnim >= all[0].length - 1) countAnim = 0;
          },
        });
        resolve(animBVH);
      })
      .catch(err => {
        reject(err);
      });
  });
};

loadBVH("./res/bvh/example.bvh").then(r => {
  // ...
});
```

### New features:

- 1.0.0 added matrixFromKeyframe intro class MEBvhJoint.
  Last version is in module folder [npm use last version].
  bvh loader now is adapted also for matrix-engine-webgpu.
  I use webgpu-matrix npm package for `matrixFromKeyframe` used in matrix-engine-webgpu project for skinnedMesh glb import.

### Licence

Mozilla Public License Version 2.0

### Credits

Original source:
MIT Licence
https://github.com/dabeschte/npybvh

More reference from origin source:
Euler's rotation theorem tells us that any rotation in 3D can be described by 3
angles. Let's call the 3 angles the _Euler angle vector_ and call the angles
in the vector :Math:`alpha`, :Math:`beta` and :Math:`gamma`. The vector is [
:Math:`alpha`, :Math:`beta`. :Math:`gamma` ] and, in this description, the
order of the parameters specifies the order in which the rotations occur (so
the rotation corresponding to :Math:`alpha` is applied first).
@source https://github.com/matthew-brett/transforms3d/blob/master/transforms3d/euler.py
Bonus ref:
@source https://www.khanacademy.org/math/precalculus/x9e81a4f98389efdf:matrices/x9e81a4f98389efdf:adding-and-subtracting-matrices/e/matrix_addition_and_subtraction

### About me

https://maximumroulette.com

---
_Source: https://npm.io/package/bvh-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
