Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Keep child at original scale


Fedor
 Share

Recommended Posts

I'm so much looking for a ways to do this thing.
The logic would pixijs have a property liked called "'death'".
Same as a 2d Physics simulator.
Example here in AE and newton
image.thumb.png.d1273b403533057f97b4eb4ebbb9dbcd.png

the death will disable parents influence of child's objects from the parent physic scene, but also from kinematics scale,position ....

In pixi, you need make a special update for stabilise the child influenced by parent.
And you will also need to deep understand how it update, that are very hard.
It not very performance friendly.
I not found other solution from my side!.
 

in AE with newton, you can choose what kind of parent influence you need  for your children.
Tha are very cool.

i can wait to see pixi have a similar feature for control parent influence.

Link to comment
Share on other sites

I could also keep the text apart from the object, but then I would need the screen coordinates of the object and move the text thereevery update. But the DisplayObjects have no method to get the screen coords, or I must be overlooking something...

 

Link to comment
Share on other sites

28 minutes ago, Fedor said:

I could also keep the text apart from the object, but then I would need the screen coordinates of the object and move the text thereevery update. But the DisplayObjects have no method to get the screen coords, or I must be overlooking something...

 

it work only if you now hace too mutch obj.
if you need update 200 or more obj like that, you will have a strange decal between synconise update.
You can see here a very old prototype, but if you look picture.
You will understand what can happen if you have too much obj to synchronize without the same parent.

You will have a strange picture flicking

 

Link to comment
Share on other sites

I'm not sure if this applies for what you're doing, but I've done 

player.scale.set(3, 3)

let item = new PIXI.Sprite.fromFrame('sword.png')
player.addChild(item)
player.itemInHand = item
player.itemInHand.scale.set(1/3, 1/3)

This example is pretending that I've scaled the player artwork up 3x, and then added something called `itemInHand` to the player which I didn't want scaled up,  perhaps because I had already drawn the object large enough.

So the object is scaled up, but one its children is scaled down, just to undo the scaling. The general pattern is parent.scale.x = n; child.scale.x = 1/n; not that I've ever applied such a thing generally, only ever explicitly in corner cases. I'm also using a centered anchor (obj.anchor.set(0.5, 0.5)).

Link to comment
Share on other sites

Sincerely if in your code you end up having a child of a parent that shouldn't inherit parent transform then it should probably not be a child of the parent in the first place. This sounds like trying to find an expensive and complex solution to what really is a logic flow to start with.

The obvious solution is this, if the parent transform should not be applied to the child then the child is with the wrong parent. Make a parent that doesn't have the problematic transform and add the child to it. 

Link to comment
Share on other sites

16 minutes ago, botmaster said:

Sincerely if in your code you end up having a child of a parent that shouldn't inherit parent transform then it should probably not be a child of the parent in the first place. This sounds like trying to find an expensive and complex solution to what really is a logic flow to start with.

The obvious solution is this, if the parent transform should not be applied to the child then the child is with the wrong parent. Make a parent that doesn't have the problematic transform and add the child to it. 

thats it true in some way and most context scenario.
But it could happen in a complex scenario of wanting to activate||deactivate only temporarily some specific parent inheritance.
in this context, you have no choice to create a stabilizer, which is far from being a performance friendly.

Link to comment
Share on other sites

Animate a tree with spriteSheets its a good complexe example.
You hit the tron:  the hit afect the tron rotation and children branch

you cut the branch and hit again.
You don want roation affect the cutted branch.
But keep the scale of trhon and also the scene zoom scale..

this it juste a sample example, with spriteAnimation, but it fixed with spine2d

 

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...
On 5/16/2018 at 2:54 PM, ivan.popelyshev said:

There are no solutions for that baked in pixi. You have to make your own transform that ignores parent transform. Its not newbie material but its possible. 

Hi ivan,If scaling and rotation are applied to the parent Container, how can the children transform so as not to be affected by the parent transformation. I have tried some methods but couldn't do it. Can you write a demo to illustrate?

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