Jump to content

Question about worldTransform in v2 and v3

Mathieu Anthoine

Recommended Posts



After looking at PixiJs code, I guess that The worlTransform informations of DisplayObjects are updated only in the render, by calling the private method updateTransform().


In some cases, it's a bit boring.


Here's a tricky situation I have in PixiJs v2:


1) I add a DisplayObjectContainer A to the stage and apply some transformations ( (scale, positions...)

2) I create a DisplayObjectContainer B but don't added it to the stage

3) I add a Sprite C in B

4) I add B in A

5) I call toGlobal on C


--> wrong results on toGlobal (because the worlTransform of C has not been updated when B has been added in A (that means C is now added to the displayList, its stage is no longer null))


If I execute 4 before 3, it works fine, toGlobal returns right values.


Sometimes I can't change my code (for example if I use pooling on DisplayObjects), is there a way to know when a DisplayObject is added to the displayList (when its stage property changes from null to the stage reference) ? Something similar to AS3 Event ADDED_TO_STAGE ?


Is the behavior similar in Pixi v3 ?



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...