My pleasure. Want to go a bit deeper?
Sprites have RAY intersecting! Babylon.js/spriteManager.ts at master · BabylonJS/Babylon.js · GitHub
(I suspect the pointer clicking… uses a ray, too.)
SO… let’s pretend that you “fire” a ray… from the center of sphere… to sprite.position (in render loop, every 1/10th second). Or maybe better… all sprites fire rays at sphere… ever 1/10th second. Check… if pickray.distance < 0.01… THEY COLLIDED!
I have never used spriteManager ray-intersect code, but there it is… we see it. It might be difficult to search for playgrounds that use that feature. hmm.
I DID do a really bad “rays being periodically shot… to test for subMesh intersections” playground… but it didn’t use sprites. It was a mesh-to-subMesh home-made intersection “engine”. Badly coded… by me… https://www.babylonjs-playground.com/#1B0PF#7 (watch js console and sphere colors for ray-distance-based intersect testing results). Gruesome.
See all those… ray = BABYLON.Ray.CreateNewFromTo(balloon3.position, sphere.position)
??
Yours could be similar. … change balloon3 to spriteManager.sprites[0].position… or something. Could be vector2 - to - vector3 conversion hassles, there.
OR, they might be MUCH different. Something like… spriteManager.intersects(ray: Ray, camera: Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean)…
Crap, it wants a camera for one of its params. We want to give it a sphere. hmm.
All we need is a distance from sprite to sphere. Perhaps subtract sprite.position vec2… from sphere.position vec3? hmm.
spriteManager.intersects() might not be the best route… for fake mesh-to-sprite intersection testing. More thinkin’.
Here is a playground where someone is treating a plain ol’ plane… as if it were a sprite. https://playground.babylonjs.com/#2GYRPB#4 I bet actionManager intersection triggers work fine on THAT sprite. Jerome donated another… here. Sprites on a mesh… yum. Ready for 3d player? Intersecting is REALLY a nightmare, then.
Yeah, I know you like to figure out stuff for yourself, but a little learning curve rocket-assist never hurt anyone, did it? Ok, maybe a few, but not too many. heh.