Jump to content

Moving bunch of sprites with good performance


Recommended Posts

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?

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...