Saeki Amae Posted August 6, 2020 Share Posted August 6, 2020 (edited) Hello, I'd like to ask if there is any way to replace geometry in already created graphics? The documentation says that geometry attribute in graphics object is read-only. I know I can clear and redraw but then i make new geometry instance instead of using shared one (I want to have many graphics items of same geometry). I can remove graphics object and make new object applying shared geometry to new object but then I have to mess with zIndexes and other stuff as rendering queue changes (not to mention resetting all current graphics settings like scale, tint and so on). In Sprites i can easily replace texture by modifying texture attribute. Is there some easy method of resolving this issue in Pixi v5? Edited August 6, 2020 by Saeki Amae ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 6, 2020 Share Posted August 6, 2020 (edited) Its possible with modifying "graphics.geometry.graphicsData" and calling "graphics.geometry.invalidate()" after that. Or you can do something like "drawPolygon(myPolygon)", then modify polygon, then call "graphics.geometry.invalidate()". It triggers triangulation and full rebuild of vertex buffer. Edited August 6, 2020 by ivan.popelyshev Saeki Amae 1 Quote Link to comment Share on other sites More sharing options...
Saeki Amae Posted August 8, 2020 Author Share Posted August 8, 2020 Thank you, it worked! ❤️ ivan.popelyshev 1 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.