Hi !
(Am I right to assume there’s no Playground for BabylonLite to share a repro ?)
I’m trying to port a BabylonJS project to BabylonLite, but can’t find the Math functions.
I’ve added BabylonLite via npm
Here’s my package.json
{
"name": "gu-yen-lite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"@babylonjs/lite": "*",
"typescript": "~6.0.2",
"vite": "^8.0.4"
},
"dependencies": {
"bootstrap-icons": "^1.13.1",
"earcut": "^3.0.2"
}
}
But I can’t find a way to import/use the vec3 functions described here
Did I miss a dependancy, or are the math functions not exported yet in the npm version ?
Thanks !
labris
June 18, 2026, 11:24am
2
The link you provided leads to shader vectors. Do you need them or you need “usual” vectors from here? - Babylon.js docs
Oups, wrong link indeed, it’s the “usual ones” I’m trying to use.
That’s a total miss if they are not exported. I will check that as soon as I’m at my desk
labris
June 18, 2026, 12:11pm
5
This is just a basic example
import type { Vec3 } from "babylon-lite";
import { normalizeVec3 } from "babylon-lite";
const v: Vec3 = { x: 3, y: 0, z: 4 };
const [x, y, z] = normalizeVec3(v.x, v.y, v.z);
I have it working for normalizeVec3, but not for the other methods, like addVec3
labris
June 18, 2026, 12:20pm
7
Some of them are not exported.
Missing from the public root export (import { … } from “babylon-lite”) compared to packages/babylon-lite/src/math/index.ts:
vec3
Vec3Up
addVec3
subVec3
scaleVec3
dotVec3
crossVec3
lengthVec3
negateVec3
lerpVec3
writeVec3
There is also a subtle mismatch for normalizeVec3:
Public root exports ./math/normalize-vec3.js, which takes (x, y, z) and returns a tuple.
Internal math barrel exports ./math/normalize-vec3-object.js, which takes Vec3 and returns Vec3.
Is the same with Vec4 or how does one deal with quaternions
yes quaternion are also exported
Thanks !
Do the Babylon team intends to update the npm package while quickfixing or should we build Babylon Lite ourselves ?
no I’ll do it as soon as the PR land.
I want the smoother experience for my lovely early adopters
I believe those newly exported functions be part of the one-shot document spec: Babylon-Lite/docs/lite/architecture/00-overview.md at master · BabylonJS/Babylon-Lite · GitHub
I believe there are a few exported functions that are not reflected back.
Gosh! I need an automatic system.
will fix that!