简体   繁体   中英

How to get size of bounding box in Phaser 3, Spine?

If i write sprite.drawDebug = true , it will show bouding box.

Bounding box in Spine 2D

Depending what exactly you need, it will be more or less difficult since this data is not exposed in a "user friendly" way (as far as I know) here is the link to the documentaiton

The SpinePlugin uses the sprite.drawDebug = true flag to show many different parts of the spine data.
In this example you can see, how this parts a divided: https://phaser.io/examples/v3/view/spine/draw-debug-bounds#

截图示例

With the Buttons you can switch on and off the different parts

Depending on which group of boxes you need, you would have to access the data, similar as the plugin itself. (here is the link to the plugin source code around lines 9936 ~ 10095 ). The data should be in the property sprite.skeleton , but you would have find the parts you really need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM