[SOLVED] Entity Picker don't work ( Playcanvas Vanilla )


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);
}, this);

Kind regards,
Dr. Simon Hack

Generally looks fine to me. Can you provide an example (codepen or hosted) please?


I have resetup the local playcanvas so this fix the Problem.

All the Best
Dr. Simon Hack