Error when clicking on point-cloud mesh without indices

Hello

This used to work with version 3.3, but I have just tried on the latest 4.0.1 (since it is now stable).

I am creating a custom mesh and displaying it as a point-cloud, using a material where pointsCloud = true. Since this is a point-cloud, there was previously no need to assign anything to the mesh indices (vertexData.indices), as only the positions (vertexData.positions) corresponding to the point locations were needed.

However, now it seems though the point-cloud is still rendered as before, if you click on the mesh (i.e. inside the points) an error is caught by chrome and safari (the two I’ve tested). This is shown on the javascript console, but with it has the effect of not moving the camera despite clicking and dragging the mouse.

Here’s a playground showing the issue:
https://www.babylonjs-playground.com/indexStable.html#VKBJN#248

Click inside the four points and the error is triggered (and you cannot move the camera), outside it is fine. The same thing happens with a standard material without the pointsCloud flag, but without indices it is invisible!

Uncommenting the assignment to “vertexData.indices = indices” results in normal behaviour.

Since I need to render a point-cloud I cannot (or at least certainly do not wish to) assign indices (I have several hundred points/vertices). Any suggestions how to get the original pre-4.0 behaviour would be welcome!

The error is copied below.

Uncaught TypeError: Cannot read property 'subtractToRef' of undefined
    at e.intersectsTriangle (babylon.js:16)
    at t._intersectUnIndexedTriangles (babylon.js:16)
    at t.intersects (babylon.js:16)
    at t.intersects (babylon.js:16)
    at t.a.a._internalPick (babylon.js:16)
    at t.a.a.pick (babylon.js:16)
    at HTMLCanvasElement._onPointerDown (babylon.js:16)

babylon.js:16 Uncaught TypeError: Cannot read property 'subtractToRef' of undefined
    at e.intersectsTriangle (babylon.js:16)
    at t._intersectUnIndexedTriangles (babylon.js:16)
    at t.intersects (babylon.js:16)
    at t.intersects (babylon.js:16)
    at t.a.a._internalPick (babylon.js:16)
    at t.a.a.pick (babylon.js:16)
    at e._initActionManager (babylon.js:16)
    at e._initClickEvent (babylon.js:16)
    at _onPointerUp (babylon.js:16)

I will fix it now for 4.0.2

2 Likes

I can confirm 4.0.2 has just fixed it - point clouds of the world celebrate!
I am very impressed with your quick response and fix @Deltakosh particularly on what’s clearly a rather busy day!

2 Likes