Herbert Posted October 24, 2018 Share Posted October 24, 2018 hi there, I have two overlap sprites both are interactive, how can I trigger both of their click Event? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 24, 2018 Share Posted October 24, 2018 Pixi doesn't have mechanisms like that. Flash had special method for it. https://github.com/pixijs/pixi.js/blob/dev/src/interaction/InteractionManager.js#L993 has nothing like it. However if you take pixi-display plugin and modify its interaction a bit, its possible: https://github.com/pixijs/pixi-display/blob/layers/src/InteractionManagerMixin.ts . See that "queue" thing? you have to do something like that for your case. Modify processInteractive the same way - extract recursive function from it, add all objects unde queue. It can also be separate method that you'll call. Go creative. Herbert 1 Quote Link to comment Share on other sites More sharing options...
Exca Posted October 24, 2018 Share Posted October 24, 2018 I have done similar thing by adding single listener to the parent container and then raycasting in 2 dimensions to see what was hit. Basically just iterating the containers children and collecting the items which have hitarea containing the point. Herbert 1 Quote Link to comment Share on other sites More sharing options...
Herbert Posted October 25, 2018 Author Share Posted October 25, 2018 thank you guys, I got the idea~ 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.