Jump to content

Question about PIXI sprites


trsh
 Share

Recommended Posts

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?

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

 

??

 

Link to comment
Share on other sites

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? 

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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