简体   繁体   English

如何在 Phaser 3, Spine 中获取边界框的大小?

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

If i write sprite.drawDebug = true , it will show bouding box.如果我写sprite.drawDebug = true ,它将显示边界框。

Bounding box in Spine 2D 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. SpinePlugin使用sprite.drawDebug = true标志来显示脊椎数据的许多不同部分。
In this example you can see, how this parts a divided: https://phaser.io/examples/v3/view/spine/draw-debug-bounds#在这个例子中你可以看到,这部分是如何划分的: 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 ). (这里是第 9936 ~ 10095 行的插件源代码的链接)。 The data should be in the property sprite.skeleton , but you would have find the parts you really need.数据应该在属性sprite.skeleton中,但你会找到你真正需要的部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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