Open sri-30 opened 1 year ago
There could be multiple approaches to picker. Here are a few needs we found in our projects for pickers we've implemented:
We have one annoying example where the animated model flys around, significantly departing from its point of origin making it near impossible to pick (in its current form).
Currently we pick from the physics engine and use that to select all meshes that the ray found and then fliter them by tags (pickable) we then use a customised version of the colour picker only against those meshes in order to get per pixel accuracy
I'm closing https://github.com/playcanvas/engine/pull/4637 until we have time to address feedback / make it into a final form of API, at which time it can be reopened and worked on.
https://github.com/playcanvas/engine/pull/4637 implements ray mesh-intersection. However, for animated scenes, it only refits the bvh when the mesh updates. This will result in the bvh losing quality over time, so it must be rebuilt after a certain number of frames. However, bvh building is currently not efficient enough for this to be seamless. In the future, a more efficient build method for the bvh must be implemented.