Nate написалYou can then access the polygons directly or use SkeletonBounds methods to do hit detection.
Could you please elaborate a bit on this, Nate? I looked at the following method in SkeletonBounds (libgdx):
/** Returns true if the axis aligned bounding box contains the point. */
public boolean aabbContainsPoint (float x, float y) {
return x >= minX && x <= maxX && y >= minY && y <= maxY;
}
It seems to me that this method returns true if the argument point is within the rectangle that is established by [minX,minY] to [maxX,maxY], is this correct? That is what I should interpret aligned bounding box as?
If so, this would mean that this method would, well ... suck, for very skew bounding boxes, would it not? For a triangle this could be very wrong, but for more rectangle shaped bounding boxes this would be ok. Just so I know what I am facing 🙂
I can't really see how to implement this in my libgdx game either. For Actors I can use InputListener and GestureListener and then do
Actor hit = stage.hit(event.getStageX(), event.getStageY(), true);
but how can I get a listener for the Spine bounding boxes? Should I just call
aabbContainsPoint(event.getStageX(), event.getStageY())
instead?