2 Spine bounding boxes in runtime

Hello.
I ask for help.
I added the Spine animation ( version 3.8 ) to my game made on the Solar2D SDK.
I have 2 questions:

  1. To work correctly with the Composer library, I added my display group as the 2nd argument when calling the function:

local skeleton = spine.Skeleton.new(skeletonData,mainGroup)

can this be done?

  1. I drew a bounding box around my character in the Spine editor

bb in spine

But for some reason in runtime I have 2 bounding boxes displayed on and under the character.

In the code, I add a bounding box like this:

torso = skeleton:findBone(“submarine”)
local vertices = skeleton:getAttachment (“bb_submarine”, “bb_submarine”).vertices
polygon = display.newPolygon(mainGroup, 0, 0, vertices)
polygon:setFillColor(0.5, 0)
polygon.strokeWidth = 5
polygon:setStrokeColor(0, 1, 1, 1)
polygon.yScale = -1
physics.addBody(polygon, “dynamic”)


–Update bounding box’s position
skeleton.x = polygon.x
skeleton.y = polygon.y
polygon.rotation = - torso.rotation

Why do I get 2 bounding boxes?

bb

I will be happy for any help!

I figured it out! The problem was in my code.
I put the polygon creation in function loadskeleton (…) and called it twice with different animations:

table.insert(skeletons, loadSkeleton(“anim/tito/skeleton.atlas”, “anim/tito/skeleton.json”, 0, 0, 1, “go_front”))
table.insert(skeletons, loadSkeleton(“anim/tito/skeleton.atlas”, “anim/tito/skeleton.json”, 340, 300, 1, “go_up”))