Raycasting issue

Hi - Have noticed that my raycasting method no longer works - Am assuming my method is now depreciated - but can’t find a post concerning the fix / new method. It used to be…

var from = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.nearClip);
var to = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.farClip);

this.app.systems.rigidbody.raycastFirst(from, to, function (result) { ...etc.etc...

ok cheers for any help, I’ll keep trawling the forum for the fix in the meantime :slight_smile:

Hi @jerryComo,

No need to use a callback, the method has been synchronous for quite some time:

const result = this.app.systems.rigidbody.raycastFirst(from, to);



thanks dude !

relavant PR Remove no longer compatible handling of deprecated parameter by RigidBody.raycastFirst by mvaligursky · Pull Request #5368 · playcanvas/engine · GitHub