Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get all rendered elements of skeleton. #558

Open
jacobdab opened this issue Jul 7, 2024 · 0 comments
Open

How to get all rendered elements of skeleton. #558

jacobdab opened this issue Jul 7, 2024 · 0 comments

Comments

@jacobdab
Copy link

jacobdab commented Jul 7, 2024

Hey,

I have spine2d battle ground maps. Where some elements are animated and they need to be behind/infront of character depending of y position of element/monster or character. As you can see bard has higher zOrder(Using pixi-layers) where grass has bigger y position and should have bigger zOrder. How I can extract all rendered elements of spine2d map to use in my function that sort it.
image

Tried extract data from skeleton.drawOrder, but it doesn't have all data. Please help!

        const spinesContainer = mapSpine.skeleton.drawOrder;
        slotPositions = spinesContainer.map(slot => {
            const element = slot.currentSprite || slot.currentMesh;

            if(!element) {
                return;
            }
            const coordinates = convertVertexData(element.vertexData);
            const maxY = findMaxY(coordinates);
            const yPosition = maxY
            slot.parentLayer = window.layer; // Ustaw warstwę dla slotu
            return {
                slot,
                worldPositionY: yPosition
            };
        });

Using pixi-spine@4.0.4, pixi.js@7.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant