# Some OBJ files give unhandled expression on load - babylonjs loaders

**URL:** <https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970>\
**Category:** Questions\
**Created:** [July 29, 2020, 1:29pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970 "2020-07-29T13:29:08Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 29, 2020, 1:29pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/1 "2020-07-29T13:29:08Z")

</div>

Hi guys.

Some OBJ files cannot be loaded into the scene. I open these files normally with the 3D software. There are some negative values in the file, I am not sure what is going on though. Any ideas??

Here is a playground with the specific OBJ that doesn’t work

[https://www.babylonjs-playground.com/#JUKXQD#594](https://www.babylonjs-playground.com/#JUKXQD#594)

Thanks

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 29, 2020, 1:38pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/2 "2020-07-29T13:38:10Z")

</div>

Seems like negative indices issue existed in some other engines

> <https://github.com/CesiumGS/obj2gltf/pull/191>

Can I do something about this, or this is engine side issue?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 29, 2020, 2:10pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/3 "2020-07-29T14:10:23Z")

</div>

Did you try playing with the OBJLoader options?

I feel like one of them should work

> <https://github.com/BabylonJS/Babylon.js/blob/master/loaders/src/OBJ/objFileLoader.ts#L36>

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 29, 2020, 2:55pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/4 "2020-07-29T14:55:15Z")

</div>

How do it set those options? I am importing babylonjs-loaders module, and loading files like in a playground, with the loader plugin defined inside the importMesh method.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 29, 2020, 3:12pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/5 "2020-07-29T15:12:12Z")

</div>

You should be able to set them as static ong the class as well (check the code of objloader, it is pretty straightforward)

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 29, 2020, 4:38pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/6 "2020-07-29T16:38:47Z")

</div>

Okay, I managed to play with the properties. But nothing helped. Maybe I missed something. This is kinda major issue in the project at the moment. If I don’t find solution for this I will have to go for some server side conversion process, which I would really like to avoid (as models like this are coming from the one of the major platforms that we need to support).

Every model exported from [tinkercad.com](http://tinkercad.com) has same issue. It seems that they are using nurbs modeling technique which sets these negative indices values.

This is what my colleague reported to me

based on the babylonjs.loaders.min.js file it looks like line 1001 of babylonjs.loaders.js is where the error is thrown: “Cannot read property ‘x’ of undefined” … the undefined var is wrappedPositionForBabylon[l]

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 29, 2020, 5:06pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/7 "2020-07-29T17:06:54Z")

</div>

If you look at the console you’ll see that the OBJLOader is not recognizing the attribute v which is used a log. There is something you need to change at exportation level I guess

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 29, 2020, 5:07pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/8 "2020-07-29T17:07:36Z")

</div>

I’ll try to what is happening in the meantime

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 29, 2020, 5:09pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/9 "2020-07-29T17:09:02Z")

</div>

Wait I think I know what is wrong

OK issue found…Will be live in a couple of hours

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [July 29, 2020, 7:14pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/10 "2020-07-29T19:14:03Z")

</div>

Thank you @Deltakosh. You are a lifesaver, as usual. 😃 It works now in the playground, but not in my app still.

Do I have to do something to make it work in my app? I forgot to note that I am using latest preview, not 4.1.0 As 4.1.0 is missing one of key features I need.

Is that an issue now?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 29, 2020, 7:56pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/11 "2020-07-29T19:56:24Z")

</div>

I checked [this file](https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview%20release/loaders/babylonjs.loaders.js), the changes are in.

So make sure you retrieved the latest babylonjs.loaders.js file / that the cache of the browser is cleaned.

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [August 3, 2020, 5:05pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/12 "2020-08-03T17:05:52Z")

</div>

Hey guys. I still didn’t make this work in the app. So if I install v4.2.0-alpha.27 and use

import ‘babylonjs-loaders’ this should work?

I tried reinstalling packages, upgrading, downgrading. I think cache is not an issue. It feels to me like I am not grabbing the right dependency somehow.

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [August 5, 2020, 8:16pm UTC](https://forum.babylonjs.com/t/some-obj-files-give-unhandled-expression-on-load-babylonjs-loaders/12970/13 "2020-08-05T20:16:18Z")

</div>

Solved this by manually grabbing that file from the CDN. npm install seems like didn’t grab the right file. Not sure what is going. But I will mark this as solved.

Thank you guys for you help. Cheers.
