I recently purchased Spine and I would like to use bounding boxes for my collision detection but I’m having trouble figuring out how to use the bounding boxes to do this.
I previously created a working game prototype in libGDX that detects collisions between a man and an object. I created a transparent rectangle over the object and a transparent circle over the man.
manCircle = new Circle();
manCircle.set(x,y,radius);
topSpriteRectangle = new Rectangle(x,y,width,height);
To detect a collision, I have:
if (Intersector.overlaps(manCircle, topSpriteRectangle)) { do something}
This is very simple and works great but now that I purchased Spine, I would like to use bounding boxes for collision detection since these boxes have many vertices and would do a more accurate detection.
I created a Bounding Box in Spine for the man and the Jason file shows:
"head-bb": {
"head": {
"type": "boundingbox",
"vertexCount": 6,
"vertices": [ -19.14, -70.3, 40.8, -118.07, 257.77, -115.62, 285.16, 57.18, 120.77, 164.95, -5.07, 76.95 ]
}
},
I would like to detect a collision between a Spine bounding box and a rectangle and between two Spine bounding boxes. I couldn’t seem to find an easy way to do this without writing my own collision detection methods.
Can you help or point me to an example.
Thanks