I am a total beginner with Babylon and 3D in general and I recently inherited of a project. I have data in .babylon file that were generated and worked in Babylonjs v2.2 (with some modification in the babylon.js file of the time).
When I click inside the cube in the example I have the following error in the console :
babylon.js:16 Uncaught TypeError: Cannot read property ‘subtractToRef’ of undefined
at e.intersectsTriangle (babylon.js:16)
at t._intersectTriangles (babylon.js:16)
at t.intersects (babylon.js:16)
at t.intersects (babylon.js:16)
at t.s.a._internalPick (babylon.js:16)
at t.s.a.pick (babylon.js:16)
at e._initActionManager (babylon.js:16)
at e._initClickEvent (babylon.js:16)
at _onPointerUp (babylon.js:16)
I think that the data format exported might not be correct, but I can’t tell what’s the problem because I have no Babylon notion nor 3D notions. It might be something totaly different.
I notice that the pointerUp uses t.s.a.pick (babylon.js:16) and if I do a manual scene.pick I have the same error.
I hope that I am clear enough.
Could someone tell me why I can’t pick on the scene loaded from my .babylon file ?
Hello,
I reexported the scene and I get the same result.
Could you tell me wich submesh are you talking about ?
And may be try to explain what the indexes referes to ? or should be ?
@Wingmut
The exporter was custom made by a someone a long time ago from a proprietary format (which I do not know).
I cannot really update the exporter without breaking something ^^
Thanks for the json file viewer.
Actually you can even see in the screenshot upper that the number of verts is 2 therefore not a complete triangle and I am sure-ish that you rely on triangle mode.
verts stand for vertices, which is one single point and gpu usually draws triangles so needs three of them therefore the huge suspition on a mesh containing only 2 of them.
I usually debug by running the code locally following the instructions from the getting started guide in the documentation.
Ok thank you for the explanation, I’ll try to check the exporter to know what it does.
However I realised than the mesh we are talking about is a “line mesh” it only has 2 points. Not 3. Do I have to add a “fake” point to have 3 ?
For the debug, I don’t understand what you mean by locally ? I have the babylon.js script on my local project (because I try to make the same modification the person who did this in v2.2 however I could not). I’m totally a beginner in web dev and javascript/typescript. So I’ll try to make it work.
I have an angular 8 solution, so I import the babylon module (babylon.d.ts). I don’t know yet how to use babylon.max.js in the debugger. Next week I get support from a web developper, I’ll ask him how to do that. He should be able to help me. Let’s hope ^^
But the important thing is that the exported file is probably wrong. Do you have an idea to export correctly line meshes ?
So I tried to set “pickable”: false on meshes with “isLine”: true. I don’t have the error in the console, however as expected I can’t use scene.pick on those lines wich I need to do. I need to be able to select faces and edges.