Polygon shaped sprite cells?

This PG shows the sprite pickable area is always rectangular. Clicking on empty space (or 0 alpha from the png file) rotates the sprites. spriteManager.cellWidth and spriteManager.cellHeight define the clickable area as rectangular.

https://www.babylonjs-playground.com/#5GX5DZ

Is it possible for polygon cell shapes or clickable areas like a triangle or hexagon? Or for some other work around?

Thanks.

1 Like

Hello! unfortunately no this is not supported yet but I will try to add it asap (I will report it when done)

1 Like

Here we are: Sprites - Babylon.js Documentation

Deploy is in progress. This will work in a couple of hours: https://www.babylonjs-playground.com/#9RI8CG#123

3 Likes

Have the changes taken effect yet? I see no change in the PG.

Thanks so much :smiley: :smiley:

Would it be possible to set the alpha threshold manually? Some sprites might contain varying alpha in different areas and may not detect the Pick.

i.e. if alpha > i (rather than the hard wired 0.5).

Changes are live (you may have to clear the cache of your browser)

For the threshold, do you want to do a PR and add a aphaThreshold on the sprite ?

1 Like

Great! Thanks again, its working. :smiley:

I clicked on the Create Pull Request on the babylon github page and it took me to the Compare page, but I don’t know the next step. I don’t have much time to do anything complex.

Maybe this could help: Start Contributing to Babylon.js - Babylon.js Documentation

Thanks DK for the link, but my sprites are working well with the current build.

1 Like