Hey team,
We noted a new issue with Babylon 5 that we never had previously.
When colliding with objects we sometimes hit a .copyFromPoints
error that freezes the engine.
Uncaught TypeError: Cannot read properties of undefined (reading 'x')
at Plane.copyFromPoints (math.plane.ts:114:27)
at Collider._testTriangle (collider.ts:244:43)
at Collider._collide (collider.ts:523:26)
at Mesh.AbstractMesh._collideForSubMesh (abstractMesh.ts:1761:18)
at Mesh.AbstractMesh._processCollisionsForSubMeshes (abstractMesh.ts:1793:18)
at Mesh.AbstractMesh._checkCollision (abstractMesh.ts:1818:14)
at DefaultCollisionCoordinator._collideWithWorld (collisionCoordinator.ts:89:22)
at DefaultCollisionCoordinator.getNewPosition (collisionCoordinator.ts:47:14)
According to this post below, the solution suggests the issue to come from a bad mesh.
The error is the same as in the post above and the console guides us to this:
However our meshes have been fine with collision since 4.2.0 and doing a quick console.log doesnât seem to reveal any faulty mesh.
console.log(!(indices.length % 3))
Iâve also been trying to reproduce the bug in
but I canât do it.
The playground contains Polytext meshes (3D text as mesh).
How we reproduce it in our game is we keep bumping into things and it eventually causes the error, I noted that spawning directly inside the object can also cause issues
Therefore all I can do is ask what could be leading to such error? What could lead to Babylon failing with collision?
Cheers
UPDATE
I reproduced it in the follow playground:
https://playground.babylonjs.com/#CIAXMC#6
In that playground you spawn somewhat within a polytext and therefore get bumped to the side. However in this case, the engine crashes.
All I did was change generateText('Poly',scene)
(line 251)
to generateText('Polyyyygggggggggggggggg',scene)