Can't understand collisions in codea

How does the collisions actually work in codea? I got some circles that need to call a function as long as they are touching, now the collision detection work 90% of the time when I expect it to. It seems like codea stops recognizing contact points after the bodies have been stationary/touching at the same point after a while(I have set sleepingAllowed to false)


if contact.bodyA ~= nil and contact.bodyB ~= nil then
        if bodyAinfo[1] == "bot" then
            if bodyBinfo[1] == "player" then
                for j=1,#Bots do
                    local info = split(Bots[j]:getBody().info,":")
                    if bodyAinfo[2] == info[2] then
                        if contact.state == BEGAN or contact.state == PERSIST then
                        elseif contact.state == ENDED then

The Bots[] is an array of classes containing the body of the specified bot. I use the userdata on each body to identify it easier with “bot:id” where id is the position in the Bots array

Sorry if Im not clear on what the problem is but its kinda hard to explain

Why not post some code for us to look at? Make sure it’s formatted neatly by putting three ~ on a line before your code! and three more on a line after your code.

@multinfs try to set the sleepingAllowed property of your bodies to false and see it it changes something.

@jmv38 I do have sleepingAllowed to false already and that doesn’t fix the problem