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


#1

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


#2

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


#3

Dear,

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

All the Best
Dr. Simon Hack