As the title explains, how would I got around to get this coordinate in screen space? I’ve mostly issues with the fact that having the pivot offset messes up my calculations. I made a small example playground:
https://playground.babylonjs.com/#2HQNW6#3
You could use Vector3.Project on the particle’s position maybe? Babylon.js Playground (babylonjs.com)
Thanks! however the issue I’m running into is doing it without the use of picking, the end goal of why I need this is to get the screen coordinates of the bottom of the (now) disc particle. I just can’t seem to accurately get the correct location:
Oooh, I see, so you don’t want the screen coords of the center, but of another location on the particle, right? Well, in your case, since the particle is a disc, instead of projecting the particle position you could project position + radius
and that should work.
Even trying to use the current code you gave as an example I actually seem to be getting fluctuating results:
https://i.imgur.com/VGk5Vuu.png
https://i.imgur.com/4P0u7xl.png
I think the difference is created from the billboard/pivot that are applied?
My current playground:
https://playground.babylonjs.com/#2HQNW6#14
You’re right, billboard and pivot change the particle’s final position: Babylon.js/solidParticleSystem.ts at master · BabylonJS/Babylon.js (github.com), Babylon.js/solidParticleSystem.ts at master · BabylonJS/Babylon.js (github.com), so you’d have to do these same operations to find out the correct position to project
I wish my understanding of math / matrices / etc. was up to snuff, but I have to admit that I’m struggling to inverse/understand those calculations…
I think I got a semi accurate position for the center point, but I’m having issues getting any other point, like the bottom of the disc for example.
Could someone maybe give me a push in the right direction? I’m still struggling to figure this one out. Thanks in advance!
Going through the particles code again, I found out what might be a simpler way. Since the “updated” positions of the particles are considered to build the bounding box: Babylon.js/solidParticleSystem.ts at master · BabylonJS/Babylon.js (github.com), you could use the boundingInfo to get the position you want? Babylon.js Playground (babylonjs.com)