KanaX

Pixi.js - Get Values of Container, Without Inheriting Z

Recommended Posts

I'm fairly new to pixi.js and programming altogether.

I am making a plugin that parses the xml save file of a sprite animation program and recreates the result in a game engine.

The animation program uses bones for skeletal animations and the images (sprite parts) inherit the x, y, angle, scale_x, scale_y of the parent bone.

The main idea would be to create sprites for the bones and the images, set up the bone inheritance to make the skeleton animation work correctly and then addChild the image sprites to the respective bone sprites. The only problem is that along with the aforementioned values, my image sprites also inherit the z_index of their container. The spriter does not limit the z hierarchy of the images to that of the parent bones, meaning that the user can change their z.

I attempted to use worldTransform and worldAlpha for the parent bone values (keeping all the image sprites in a single container, thus controlling the z_index), but I am unable to get the parent bone's rotation.

So, I either need to get all the values of the container and apply them correctly on the image sprites, or keep the image sprites inside the container and find a way to change their world z.

Any suggestions would be appreciated and I thank you for your time.
 

 

Share this post


Link to post
Share on other sites

Make bone structure separate, or just use https://github.com/pixijs/pixi-display/tree/layers (new branch of pixi-display) , it can sort elements in a subtree.

As a first implementation it will work fine: you need to put a Layer container inside your object and assign all the attachments z-index and parentLayer. Also your stage must be PIXI.display.Stage, anyway look through examples.

Then you can make separate structure of bones and transforms, like in https://github.com/pixijs/pixi-spine and https://github.com/EsotericSoftware/spine-runtimes/tree/3.6/spine-ts

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.