BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.06k stars 3.41k forks source link

simplify mesh scene fails #3868

Closed vsantosu closed 6 years ago

vsantosu commented 6 years ago

Bug:

Im trying to simplify the Alien GLB model, but following the documentation tutorial it throws error.

Simplification fails when loading GLB/GLTF mesh.

Uncaught TypeError: Cannot read property 'length' of undefined

at t.simplify (babylon.js:47)

at n (babylon.js:47)

at e._fn (babylon.js:47)

at e.executeNext (babylon.js:4)

at Function.e.Run (babylon.js:4)

at t.runSimplification (babylon.js:47)

at t.executeNext (babylon.js:47)

at i.render (babylon.js:13)

at index.js:431

at o._renderLoop (babylon.js:5)`

https://www.babylonjs-playground.com/#JSSWZ2

RaananW commented 6 years ago

Hi, this is because you are simplifying a mesh with no geometry. GLTF's first mesh is usually a root mesh with no geometry (same thing goes to The Dude for example). If you choose a mesh that does have a geometry, it works - https://www.babylonjs-playground.com/#JSSWZ2#1 , thou I won't recommend simplifying an animation-enabled mesh, as the results are unexpected.