• Runtimes
  • How to use getPolygon?


Hey,

When I try to getPolygons from my Skelbound it returns null.

What I'm doing wrong?

spine.skeleton.updateWorldTransform();
   const skelBounds = new SkeletonBounds()
   skelBounds.update(spine.skeleton, true); 
   // skelBounds return {
   // "minX": null,
   // "minY": null,
   // "maxX": null,
   // "maxY": null,
   // "boundingBoxes": [],
   // "polygons": [],
   // "polygonPool": {
   //    "items": []
   // }
   //}
   skelBounds.getPolygon(spine.skeleton.findSlot('ca4').attachment); // return null

Related Discussions
...

Does the skeleton have a bounding box created in the Spine editor?

Make sure spine.skeleton.findSlot('ca4').attachment is a BoundingBoxAttachment. If the skeleton has none attached, skelBounds.boundingBoxes will be empty.

Nate a écrit

Make sure spine.skeleton.findSlot('ca4').attachment is a BoundingBoxAttachment. If the skeleton has none attached, skelBounds.boundingBoxes will be empty.

Yes, it has existing BoundingBoxAttachment.