trsh Posted September 14, 2016 Share Posted September 14, 2016 Example: https://jsfiddle.net/8du4erv2/2/ Things I don't understand 1) Why is the SUB bunny as big as first, because I haven't added w, h or scale for it? 2) Why is the SUB bunny positioned like that? Basic math tell's me X=200 (bunny pos.) + X=10.5 (sub bunny), should be 210.5. From watching in PIXI source, I see the reason is that parent matrix is added to Child. But, this makes really hard to work with nested sprites. If I want the subBanny with default size, positioned in 10.5 in bunny, I would have to manually calculate dimension and position parameters, so when matrix is added, it looks right? Shouldn't PIXI add parent matrix to child, only if The child already added to That parent... or something like that? Quote Link to comment Share on other sites More sharing options...
trsh Posted September 14, 2016 Author Share Posted September 14, 2016 When I work for example with SVG or KHA, there is default width and height and position, that has nothing to do with transforms. Transform is only applied when you start scale, move, etc. And if you choose to do so. Quote Link to comment Share on other sites More sharing options...
douglas Posted September 14, 2016 Share Posted September 14, 2016 first, thank you because you've fixed that ssl issue i was blocked with phaser second, seems like assets directly from github are working fine with pixi then, i am trying to understand (to be edited if i find the problem ) Quote Link to comment Share on other sites More sharing options...
trsh Posted September 14, 2016 Author Share Posted September 14, 2016 4 minutes ago, douglas said: first, thank you because you've fixed that ssl issue i was blocked with phaser second, seems like assets directly from github are working fine with pixi then, i am trying to understand (to be edited if i find the problem ) What? Quote Link to comment Share on other sites More sharing options...
douglas Posted September 14, 2016 Share Posted September 14, 2016 I edit my responses and comments after because of google bots, so, when someone is googling a question on phaser he'll find the right answer so the devs can optimise the search on the forum Quote Link to comment Share on other sites More sharing options...
themoonrat Posted September 14, 2016 Share Posted September 14, 2016 28 minutes ago, trsh said: 1) Why is the SUB bunny as big as first, because I haven't added w, h or scale for it? 2) Why is the SUB bunny positioned like that? Basic math tell's me X=200 (bunny pos.) + X=10.5 (sub bunny), should be 210.5. When you set the width & height of a sprite, internally you are actually ARE changing it's scale. Thus, you have scaled the first bunny - and since the second bunny is a child of the first bunny, it will also get scaled. Quote Link to comment Share on other sites More sharing options...
trsh Posted September 14, 2016 Author Share Posted September 14, 2016 Just now, themoonrat said: When you set the width & height of a sprite, internally you are actually ARE changing it's scale. Thus, you have scaled the first bunny - and since the second bunny is a child of the first bunny, it will also get scaled. I already wrote that my self. Can you comment on: Quote But, this makes really hard to work with nested sprites. If I want the subBanny with default size, positioned in 10.5 in bunny, I would have to manually calculate dimension and position parameters, so when matrix is added, it looks right? Shouldn't PIXI add parent matrix to child, only if The child already added to That parent... or something like that? ?? Quote Link to comment Share on other sites More sharing options...
douglas Posted September 14, 2016 Share Posted September 14, 2016 Quote 1) Why is the SUB bunny as big as first, because I haven't added w, h or scale for it? My comprehension is at this point https://jsfiddle.net/johndo101/wwqusgfL/1/ Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 14, 2016 Share Posted September 14, 2016 Because "width" changes the scale. I had proposition about "size" variable that behaviour is different. It isnt accepted yet. Right now you have to use extra container that will be parent to both of these bunnies to solve that. Quote Link to comment Share on other sites More sharing options...
trsh Posted September 14, 2016 Author Share Posted September 14, 2016 1 hour ago, ivan.popelyshev said: Because "width" changes the scale. I had proposition about "size" variable that behaviour is different. It isnt accepted yet. Right now you have to use extra container that will be parent to both of these bunnies to solve that. Noooooooooooooo! :)) So.. The architectural right now is a little bit off! Because some objects could be like 100% static, and they dont need Transformation (updateTransformation etc,) at all, still can have x,y,w,h and been drawn. Right now pixi calls updateTransform on every frame and object? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 14, 2016 Share Posted September 14, 2016 @trsh yeah, it calls it every time, but matrix computations are performed only if something was changed. pixi v3 computed all matrices every frame. Quote Link to comment Share on other sites More sharing options...
trsh Posted September 14, 2016 Author Share Posted September 14, 2016 13 minutes ago, ivan.popelyshev said: @trsh yeah, it calls it every time, but matrix computations are performed only if something was changed. pixi v3 computed all matrices every frame. OK. Thanks for the info. 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.