How to get all rendered elements of skeleton.
Opened this issue · 0 comments
jacobdab commented
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.
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