garry Posted October 23, 2018 Share Posted October 23, 2018 So I have bunch of sprites (couple of hundreds) with various positions and I need to move every one of the sprites to a same specific location. now I can just update their position one by one but the performance is not the best in this way. but when I put them all in a container and just move the container the performance is much better. but the problem is that each sprite have a various position so they can't get to a same location because well I'm just moving the container. so I was just wondering if there is a way to achieve this with a good performance? any ideas? is there a answer for this question or moving the sprites one by one is just the only way? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 23, 2018 Share Posted October 23, 2018 Pixi way: recalculate all matrices and draw all sprites every frame. Small optimization : if position of element and position of its parent wasn't changed, dont recalculate the matrix. There's no big difference between moving every sprite and moving container because pixi re-calculates all matrices every frame anyway. There's small optimization, but its not that important. The real problem is somewhere else. I hope you dont call "renderer.render" every time you move something garry 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.