求教spine碰撞判定问题

各位大牛,小弟最近在creator上用spine,需要做碰撞判定
但获取到的slot.Attachment对象只有name和type两个属性。不知怎样获得bounding box等信息。
请问各位,这个应该怎样解决呢?万分感谢!

spine 的碰撞检测可以使用官方提供的 SkeletonBounds 类来实现。Web 平台下,可以使用类似这样的代码做碰撞检测。

var bounds = new sp.spine.SkeletonBounds();
bounds.update(skeleton._sgNode._skeleton);
bounds.aabbContainsPoint(x, y);

SkeletonBounds 提供了非常多的 API,包括获取 bounding box,详情请看 https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-ts/core/src/SkeletonBounds.ts

3赞