playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.32k stars 1.32k forks source link

Support ray intersects mesh instances #3542

Open mvaligursky opened 2 years ago

mvaligursky commented 2 years ago

We should consider support for mesh picking without using physics engine.

There's an older PR which implements this, but it would need to be updated to latest changes with the engine, or at least used as a base: https://github.com/playcanvas/engine/pull/989

mvaligursky commented 2 years ago

We can also consider construction of BVH from the mesh and implement fast ray to BVH intersection. Reference: https://jacco.ompf2.com/2022/04/18/how-to-build-a-bvh-part-2-faster-rays/

leonidaspir commented 2 years ago

That would be super useful to have, this three.js library does something similar. When working with three.js it's very easy to enable on any mesh instance and do fast raycast lookups.

https://github.com/gkjohnson/three-mesh-bvh

mvaligursky commented 1 year ago

PR https://github.com/playcanvas/engine/pull/4637