oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.71k stars 211 forks source link

Mat4Func - getRotation() creates NaN when code get compiled #172

Closed FredericBriolet closed 1 year ago

FredericBriolet commented 1 year ago

Hey, first thanks for this awesome library!

It's the second time I have this very weird bug: the Camera matrix and worldMatrix both become a list of NaN values. It doesn't happen when running npm run dev, it happens only when I build and preview, on nextjs projects.

The error comes from Mat4Func.js, function getRotation(). I fixed it by changing line 550: const temp = [0, 0, 0]; into this: const temp = [1, 1, 1];

I suspect some division by zero happening in some specific cases. 🤷

gordonnl commented 1 year ago

Thanks for finding that!