I tried your program in Safari debugger and the object returned at the line
Code: Select all
var obj = HPC.getComponent3D().getClosestItemAt(x, y);
was "almost" found. By "almost", I mean that your x,y coordinates are wrong, and you should translate them in canvas space, removing [font=courier new]rect.x[/font] and [font=courier new]rect.y[/font] (but [font=courier new]rect[/font] can't be correct because you forgot brackets at the end of [font=courier new]canvas.getBoundingClientRect[/font]).
You should really learn how to use a JavaScript debugger.