Musashi

Hi,

I'm extending a Godot's unofficial C++ runtime, following work on: More precise Bounding Box?

I managed to get a chosen Spine bounding box used the the physics shape and get all bounding boxes rendered for debugging purposes, being keyed and all. As one would for a fighting game.

The one thing missing is the 'deform' entries for bounding boxes. How should I interpret those? Is there any docs I can refer to?
"deform": {
"default": {
"defense": {
"defense": [
{},
{
"time": 0.1667,
"offset": 4,
"vertices": [ 25, 0, 25 ]
},
{ "time": 0.4167 }
]
}
}
}
Then from C++ for slot->getDeform() I'm getting an array of [-25, 0, -25], not sure what to do with that info to modify the rectangle.

Thanks!
Musashi
  • 記事: 7

Nate

I don't think you want to go so low level that you need to deal with the vertices stored for each deform key and how to apply that data. Instead, you apply an animations via AnimationState or the timeline API, then you use BoundingBox computeWorldVertices and use those to draw, set the vertices of a physic body, etc.

This works in the same way that bone transforms, etc work. You don't need to muck around with the data stored for the bone transform keys. Instead applying animations sets the pose in the your skeleton, then you make use of that.

We provide a class called SkeletonBounds to collect all the visible bounding box attachments and compute the world vertices that make up the polygon for each one. You could use that class, or you could do the same on your own.

SkeletonBounds provides some simple methods for hit detection, such as containsPoint and intersectsSegment. Here\'s an example using spine-sfml. You can also get the polygons and bounding boxes from it and use them directly. Here\'s and example of that (in Java but the idea is the same).
アバター
Nate

Nate
  • 記事: 11795

Musashi

Ah makes sense, I was using the API wrong then,
computeWorldVertices
works fine. Thanks!
Musashi
  • 記事: 7


Return to Runtimes