Josepho Posted February 4, 2014 Share Posted February 4, 2014 Hi there, is there any kind of way to z sort the displayobjects in an easy way in pixi? Has the displayobjects any kind of atribute that zsorts them in the renderer or anything like that? or should i sort them in the child array by myself? Thanks! Quote Link to comment Share on other sites More sharing options...
Sebi Posted February 4, 2014 Share Posted February 4, 2014 The children array is rendered from top to bottom, so you have to sort that array on your own.Afaik theres no z-order system yet, but should be fairly easy to overwrite the addChild method to support z-index. Quote Link to comment Share on other sites More sharing options...
1-800-STAR-WARS Posted February 5, 2014 Share Posted February 5, 2014 There's also an addChildAt method which will let you insert a display object in the middle of the list. Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted February 6, 2014 Share Posted February 6, 2014 Yo! Assuming you have a z property on you sprites to control depth..function depthCompare(a, { if (a.z < b.z) return -1; if (a.z > b.z) return 1; return 0;}myContainer.children.sort(depthCompare); Quote Link to comment Share on other sites More sharing options...
Josepho Posted February 7, 2014 Author Share Posted February 7, 2014 Many thanks! Quote Link to comment Share on other sites More sharing options...
vitolipari Posted March 23, 2015 Share Posted March 23, 2015 Hi to everybody.I have two containers, how can i sort all object into the two system?I have a particle system ( a PIXI.SpriteBatch ) and some sprite into the stage.Every spriteBatch object and every stage sprite have the "z" attribute.I would sort the sprite ( into the stage ) and the objects ( into the sproteBatch ) based on the "z" attribute. Quote Link to comment Share on other sites More sharing options...
neonwarge04 Posted November 11, 2015 Share Posted November 11, 2015 With all due respect. I don't know why z-index is not part of PIXI. C'mon, even SFML has this. What's your excuse on this one? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 11, 2015 Share Posted November 11, 2015 There can be 100 different implementations of Z-layer, we can do them as a plugins. Just tell me what kind of z-index you need, do you want to use DEPTH_BUFFER or sort all sprites in scene? C'mon, even SFML has this. What's your excuse on this one? For example, that thing will mess with filters and particles. Quote Link to comment Share on other sites More sharing options...
xerver Posted November 11, 2015 Share Posted November 11, 2015 With all due respect. I don't know why z-index is not part of PIXI. C'mon, even SFML has this. What's your excuse on this one? SFML is also not a 2d library, it is a gl wrapper. PIXI is not a gl wrapper, it is a 2D library. Z-index in 2D games is very application specific. We left that to userland. 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.