Dear,
If I use the entity picker with vanilla JS, playcanvas showed the followed error:
TypeError: e is undefined | playcanvas.js:1177:355
My code:
var camera = new pc.Entity('camera');
camera.addComponent('camera', {
clearColor: new pc.Color(0.1, 0.1, 0.1)
});
app.mouse.on(pc.EVENT_MOUSEDOWN, function (e) {
var from=camera.camera.screenToWorld(e.x, e.y, camera.camera.nearClip);
var to=camera.camera.screenToWorld(e.x, e.y, camera.camera.farClip);
var result=app.systems.rigidbody.raycastFirst(from, to);
if(result){
console.log(result);
}
}, this);
Kind regards,
Dr. Simon Hack