oschakravarthi Posted November 19, 2018 Share Posted November 19, 2018 Hi, I am getting a couple of exceptions when working with CSG. Please help me. Thanks in advance. Case 1: var myCSG = BABYLON.CSG.FromMesh(myMesh); Exception: TypeError: Cannot read property 'length' of undefined at HOST._registerEnvironmentCore (http://localhost:51879/app/js/diwise.babylon.host.max.js:141:44) at http://localhost:51879/app/js/diwise.babylon.host.max.js:160:23 at d (http://localhost:51879/app/js/external/babylon.js:1:1199438) at http://localhost:51879/app/js/external/babylon.js:1:1199625" The below is the myMesh json from the .babylon file "materialId": null, "isEnabled": true, "isVisible": true, "positions": null, "normals": null, "tangents": null, "uvs": null, "uvs2": null, "colors": null, "hasVertexAlpha": false, "matricesIndices": null, "matricesWeights": null, "matricesIndicesExtra": null, "matricesWeightsExtra": null, "indices": null, "receiveShadows": false, "infiniteDistance": false, "billboardMode": 0, "visibility": 1.0, "subMeshes": null, "instances": null, "skeletonId": -1, "numBoneInfluencers": 4, "applyFog": false, "metadata": null, "rotation": null, "scaling": [1.0, 1.0, 1.0], "rotationQuaternion": [-0.7071, 0.0, 0.0, 0.7071], "actions": null, "checkCollisions": false, "pickable": true, "showBoundingBox": false, "showSubMeshesBoundingBox": false, "alphaIndex": 0, "physicsImpostor": 0, "physicsMass": 0.0, "physicsFriction": 0.0, "physicsRestitution": 0.0, "name": "Aparna_Bare_Aparetment", "id": "6882f559-019a-4dd6-bad8-eed949a829cc", "parentId": null, "position": [-166.4937, 16.804, -2169.72632], "animations": [], "autoAnimate": true, "autoAnimateFrom": 0, "autoAnimateTo": 100, "autoAnimateLoop": true Case 2: myCSG = myCSG.subtract(BABYLON.CSG.FromMesh(myMesh)); Exception: "TypeError: Cannot read property 'normal' of null at y.splitPolygon (http://localhost:51879/app/js/external/babylon.js:1:1468621) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470812) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470916) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470976) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470976) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470976) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470976) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470916) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470976) at n.build (http://localhost:51879/app/js/external/babylon.js:1:1470916)" "materialId": "508f3a91-5f5a-49e2-b0a8-4bbaec5c3a46", "isEnabled": true, "isVisible": true, "positions": [-175.5218, 5.9744, 185.1351, -175.5218, -5.9746, -185.1352, -175.5218, 5.9745, -185.1352, -175.5218, -5.9746, -185.1352, -175.5218, 5.9744, 185.1351, -175.5218, -5.9747, 185.1351, -175.5218, 5.9744, 185.1351, 175.5218, -5.9746, 185.1351, -175.5218, -5.9747, 185.1351, 175.5218, -5.9746, 185.1351, -175.5218, 5.9744, 185.1351, 175.5218, 5.9745, 185.1351, 175.5218, 5.9746, -185.1352, 175.5218, -5.9746, 185.1351, 175.5218, 5.9745, 185.1351, 175.5218, -5.9746, 185.1351, 175.5218, 5.9746, -185.1352, 175.5218, -5.9745, -185.1352, -175.5218, 5.9745, -185.1352, 175.5218, -5.9745, -185.1352, 175.5218, 5.9746, -185.1352, 175.5218, -5.9745, -185.1352, -175.5218, 5.9745, -185.1352, -175.5218, -5.9746, -185.1352, 175.5218, 5.9745, 185.1351, -175.5218, 5.9744, 185.1351, -175.5218, 5.9745, -185.1352, 175.5218, 5.9745, 185.1351, -175.5218, 5.9745, -185.1352, 175.5218, 5.9746, -185.1352, -175.5218, -5.9746, -185.1352, -175.5218, -5.9747, 185.1351, 175.5218, -5.9745, -185.1352, 175.5218, -5.9745, -185.1352, -175.5218, -5.9747, 185.1351, 175.5218, -5.9746, 185.1351], "normals": [-1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, 1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039, -0.0039, -1.0, -0.0039], "tangents": null, "uvs": [0.4443, 1.9655, 0.4292, 1.502, 0.4443, 1.502, 0.4292, 1.502, 0.4443, 1.9655, 0.4292, 1.9655, 0.0168, 1.0024, 0.0018, 1.4985, 0.0018, 1.0024, 0.0018, 1.4985, 0.0168, 1.0024, 0.0168, 1.4985, 0.4236, 1.9655, 0.4087, 1.502, 0.4236, 1.502, 0.4087, 1.502, 0.4236, 1.9655, 0.4087, 1.9655, 0.0384, 1.4985, 0.0234, 1.0024, 0.0384, 1.0024, 0.0234, 1.0024, 0.0384, 1.4985, 0.0234, 1.4985, 0.5083, 1.0024, 0.5083, 1.4985, 0.0448, 1.4985, 0.5083, 1.0024, 0.0448, 1.4985, 0.0448, 1.0024, 0.45, 1.502, 0.9136, 1.502, 0.45, 1.998, 0.45, 1.998, 0.9136, 1.502, 0.9136, 1.998], "uvs2": [0.0078, 1.4141, 0.4919, 1.3989, 0.4919, 1.4141, 0.4919, 1.3989, 0.0078, 1.4141, 0.0078, 1.3989, 0.4927, 1.4453, 0.0078, 1.4302, 0.4927, 1.4302, 0.0078, 1.4302, 0.4927, 1.4453, 0.0078, 1.4453, 0.5078, 1.4141, 0.9917, 1.3989, 0.9917, 1.4141, 0.9917, 1.3989, 0.5078, 1.4141, 0.5078, 1.3989, 0.0078, 1.4766, 0.4927, 1.4614, 0.4927, 1.4766, 0.4927, 1.4614, 0.0078, 1.4766, 0.0078, 1.4614, 0.9917, 1.5073, 0.9917, 1.9922, 0.5078, 1.9922, 0.9917, 1.5073, 0.5078, 1.9922, 0.5078, 1.5073, 0.0078, 1.5073, 0.4919, 1.5073, 0.0078, 1.9922, 0.0078, 1.9922, 0.4919, 1.5073, 0.4919, 1.9922], "colors": null, "hasVertexAlpha": false, "matricesIndices": null, "matricesWeights": null, "matricesIndicesExtra": null, "matricesWeightsExtra": null, "indices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35], "receiveShadows": true, "infiniteDistance": false, "billboardMode": 0, "visibility": 1.0, "subMeshes": [{ "materialIndex": 0, "verticesStart": 0, "verticesCount": 36, "indexStart": 0, "indexCount": 36 } ], "instances": null, "skeletonId": -1, "numBoneInfluencers": 4, "applyFog": true, "metadata": null, "rotation": null, "scaling": [1.0, 1.0, 1.0], "rotationQuaternion": [0.0, 0.0, 0.0, 1.0], "actions": null, "checkCollisions": false, "pickable": false, "showBoundingBox": false, "showSubMeshesBoundingBox": false, "alphaIndex": 1000, "physicsImpostor": 0, "physicsMass": 0.0, "physicsFriction": 0.0, "physicsRestitution": 0.0, "name": "Wall_Kitchen_Main", "id": "37d29837-d9f5-4b3c-a5b8-2a6bba820957", "parentId": "6882f559-019a-4dd6-bad8-eed949a829cc", "position": [373.6895, -436.4482, 184.3937], "animations": [], "autoAnimate": true, "autoAnimateFrom": 0, "autoAnimateTo": 100, "autoAnimateLoop": true Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 20, 2018 Share Posted November 20, 2018 Do you have a playground of this not working? You can find a working example here https://playground.babylonjs.com/#T6NP3F#0 Sebavan 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.