Simple mesh and camera collision causes crash. Why?

I have a project which uses camera and mesh collision to detect when the camera hits a mesh.

The code crashes upon any collision.

It is crashing in babylon here:

e.prototype.copyFromPoints = function(e, t, i) {
var n, r = t.x - e.x, ← This line crashes with t.x not an object message in debug

While my code is rather complex, I’ve reduced it to a simple playground (my first, so I hope it works for you).

The playground is here: Babylon.js Playground

Give the right window focus and then use the UP arrow key to move the camera over the mesh. It should crash once it is over the mesh.

Why? I can’t figure out what I am doing wrong here.

All help appreciated!

The custom mesh has 7 indices, so with 3 indices per triangle, there is one left over. It works if you remove 6

Arug!!! So simple…

Thank you VERY much.

1 Like