Upsinn Posted July 15, 2016 Share Posted July 15, 2016 Hi, how can I get access to specific slot in my spine skeleton? I have simple spine skeleton animation and sprite which is a few display layers under the spine skeleton, and I need that sprite will be reproduce moves of specific slot. Is there any way how can I get global coords of the slots? Thx Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 15, 2016 Share Posted July 15, 2016 Its not a problem. You can either track its slot position, either just add sprite there. If you want to have it different z-index you can use pixi-display library. I recommend you to study the sources anyway, that will help you a lot. var index = spine.skeleton.findSlotIndex('slotName'); var slot = spine.skeleton.slots[index]; var slotContainer = spine.slotContainers[index]; //option 1 just add sprite to container slotContainer.addChild(mySprite); //assign different displaygroup if you use pixi-display. That way sprite will appear after actual spine object, where you need it mySprite.displayGroup = foregroundGroup; //option 2 track the matrix spine.updateTransform(); // slotContainer.worldTransform is the matrix. I dont know what do you want to do with it exactly var point = new PIXI.Point(slotContainer.worldTransform.tx, slotContainer.worldTransform.ty); Quote Link to comment Share on other sites More sharing options...
Upsinn Posted July 15, 2016 Author Share Posted July 15, 2016 Thanks a lot - pixi-display sounds great and its exactly what I need. Btw.: Is there any way how can I dispatch event for every update of my skeleton in pixi-spine? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 15, 2016 Share Posted July 15, 2016 8 minutes ago, Upsinn said: Thanks a lot - pixi-display sounds great and its exactly what I need. Btw.: Is there any way how can I dispatch event for every update of my skeleton in pixi-spine? wll you can just hack it, put your own function in prototype that hides original "update". But you have to understand that there are two parts of it: bones update and transform update. Bones are updated by spine runtime , while transform (sprite.worldTransform) are PIXI thing. If you turn of autoUpdate of this particular spine or even all spine instances, you can hook "spine.update(dt)" into your own cycle , and that way spine updates will be all yours Anyway, better to read the code, especially "Spine/index.js" part Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.