rroylance Posted June 5, 2014 Share Posted June 5, 2014 Hi, I need to be able to click through the transparent pixels of my sprites, how would I go about that ? I recall this being mentioned when Masking was added but I advent heard anything since and can't seem to find any answers anywhere. Using hitArea is not acceptable since the images are not simple polygons. I have used a method previously where I exported the alpha data of my textures as an array from Flash and then used the local coordinates of the touch to check the alpha array, but I would prefer to not have to do that again. Thanks. Quote Link to comment Share on other sites More sharing options...
poliman Posted June 7, 2014 Share Posted June 7, 2014 HiThe topic was discussed many time, i dont remember if it was on pixi thread. It depends what do you need it for. I encountered the same problem many times, and quickest way is to make hitArea as polygons, even complex polygons made for sprites are quicker in code than check transparency of pixels. There is a nice software for making polygons of sprites and i use it with all sprites, PhysicsEditor Im new here and not an expert, but already love Pixi, thx GoodBoy and community Quote Link to comment Share on other sites More sharing options...
rroylance Posted June 9, 2014 Author Share Posted June 9, 2014 HiThe topic was discussed many time, i dont remember if it was on pixi thread. It depends what do you need it for. I encountered the same problem many times, and quickest way is to make hitArea as polygons, even complex polygons made for sprites are quicker in code than check transparency of pixels. There is a nice software for making polygons of sprites and i use it with all sprites, PhysicsEditor Im new here and not an expert, but already love Pixi, thx GoodBoy and community Thanks for the input, that tool/ a free alternative I found called Box2d-editor should work perfectly. I never even considered the possibility of a tool to define the sprites. EDIT: I found that someone had implemented a transparency based hit area, and for my purposes (only needed for clicking/tapping) this works great. It can be found @ https://github.com/peci1/pixi.js/blob/415a86138e8b224ccce8fce5e974be439403a364/src/pixi/extras/TransparencyHitArea.js Quote Link to comment Share on other sites More sharing options...
the.adoxographer Posted September 9, 2014 Share Posted September 9, 2014 (edited) Nevermid, I had I silly question. Edited September 9, 2014 by the.adoxographer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.