Selectively turning off error messages (in the build panel)

My app generates hundreds of physics bodies.  I’ve used Physics Editor to define the complex physics bodies and after scaling them during their creation, I often get this error message:

ERROR: physics.addBody() of a “shape” with no area, or nearly no area, has been rejected

There is no negative effect on the app but the quantity of these error messages are taking over my build panel and making it inordinately difficult to debug other errors.

Can I selectively turn of this error message?  Has anyone solved this problem before?

Thanks,

Jonathan

Can you post a screen shot of the error in the console and post some code that cause this error? It’s always better to fix it then to just kick it out the door and then it walks back in and kicks you in the a** weeks/months/years later. 

Hi InfiSnyp,
 
Basically I get the following error whenever I create a new complex physics body using pre-scaled data generated by Physics Editor:
 
ERROR: /Users/Stimpy/Dropbox/Prime/libs/soma.lua:543: physics.addBody() of a “shape” with no area, or nearly no area, has been rejected.
 
I can see this error hundreds of times when I test my app and it occurs across all Corona builds.
 
Here is some code with explanations:
[lua]
local physicsData = (require “libs.shape_data”).physicsData(somaScale) – imports and scales physics data from the libs.shape_data module
 
physics.addBody( soma, physicsData:get(somaShape) ) – line 543 referenced in the error message above calls on the sized-physics data to generate complex physics bodies (in this case, ovals)
 
– Here is the physicsData module - it was provided by Physics Editor but I might have made a few tweaks
local unpack = unpack
local pairs = pairs
local ipairs = ipairs
 
local M = {}
 
function M.physicsData(scale) – returns the complex physics shape data after scaling it
local physics = { data =

– there are dozens of shapes but i’m only including one oval (shape_2).
[“shape_2”] = {                              
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   37.5, -29  ,  44.5, -11  ,  44.5, 9  ,  35.5, 31  ,  21.5, 44  ,  -22.5, -45  ,  7, -50.5  ,  24.5, -43  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -25, 42.5  ,  -38, 28.5  ,  -45.5, 10  ,  -45.5, -10  ,  -36.5, -32  ,  -22.5, -45  ,  7, 49.5  ,  -9, 49.5  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -22.5, -45  ,  21.5, 44  ,  7, 49.5  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -8, -50.5  ,  7, -50.5  ,  -22.5, -45  }
                    }        
             }       
}            
}
        – apply scale factor
        local s = scale or 1.0
        for bi,body in pairs(physics.data) do
                for fi,fixture in ipairs(body) do
                    if(fixture.shape) then
                        for ci,coordinate in ipairs(fixture.shape) do
                            fixture.shape[ci] = s * coordinate
                        end
                    else
                        fixture.radius = s * fixture.radius
                    end
                end
        end
 
function physics:get(name)
return unpack(self.data[name])
end
 
    function physics:get2(name)
        local shapeData
        for bi,body in pairs(physics.data) do
                for fi,fixture in ipairs(body) do
                    if(fixture.shape) then
                        shapeData = fixture.shape
                    end
                end
        end
        return shapeData
    end
 
function physics:getFixtureId(name, index)
                return self.data[name][index].pe_fixture_id
end
 
return physics;
end
 
return M
[/lua]
 
The physics bodies that are formed appear to be perfect as observed by the physics debug mode.  They perform as expected with no surprises even after scaling them with 2 display groups.  The only problem so far seems to be the error message itself - constantly clogging my build panel.

Can you post a screen shot of the error in the console and post some code that cause this error? It’s always better to fix it then to just kick it out the door and then it walks back in and kicks you in the a** weeks/months/years later. 

Hi InfiSnyp,
 
Basically I get the following error whenever I create a new complex physics body using pre-scaled data generated by Physics Editor:
 
ERROR: /Users/Stimpy/Dropbox/Prime/libs/soma.lua:543: physics.addBody() of a “shape” with no area, or nearly no area, has been rejected.
 
I can see this error hundreds of times when I test my app and it occurs across all Corona builds.
 
Here is some code with explanations:
[lua]
local physicsData = (require “libs.shape_data”).physicsData(somaScale) – imports and scales physics data from the libs.shape_data module
 
physics.addBody( soma, physicsData:get(somaShape) ) – line 543 referenced in the error message above calls on the sized-physics data to generate complex physics bodies (in this case, ovals)
 
– Here is the physicsData module - it was provided by Physics Editor but I might have made a few tweaks
local unpack = unpack
local pairs = pairs
local ipairs = ipairs
 
local M = {}
 
function M.physicsData(scale) – returns the complex physics shape data after scaling it
local physics = { data =

– there are dozens of shapes but i’m only including one oval (shape_2).
[“shape_2”] = {                              
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   37.5, -29  ,  44.5, -11  ,  44.5, 9  ,  35.5, 31  ,  21.5, 44  ,  -22.5, -45  ,  7, -50.5  ,  24.5, -43  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -25, 42.5  ,  -38, 28.5  ,  -45.5, 10  ,  -45.5, -10  ,  -36.5, -32  ,  -22.5, -45  ,  7, 49.5  ,  -9, 49.5  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -22.5, -45  ,  21.5, 44  ,  7, 49.5  }
                    }
                     ,
                    {
                    pe_fixture_id = “”, density = 1, friction = 0.29999999999999999, bounce = 0.20000000000000001, 
                    filter = { categoryBits = 1, maskBits = 15, groupIndex = 0 },
                    shape = {   -8, -50.5  ,  7, -50.5  ,  -22.5, -45  }
                    }        
             }       
}            
}
        – apply scale factor
        local s = scale or 1.0
        for bi,body in pairs(physics.data) do
                for fi,fixture in ipairs(body) do
                    if(fixture.shape) then
                        for ci,coordinate in ipairs(fixture.shape) do
                            fixture.shape[ci] = s * coordinate
                        end
                    else
                        fixture.radius = s * fixture.radius
                    end
                end
        end
 
function physics:get(name)
return unpack(self.data[name])
end
 
    function physics:get2(name)
        local shapeData
        for bi,body in pairs(physics.data) do
                for fi,fixture in ipairs(body) do
                    if(fixture.shape) then
                        shapeData = fixture.shape
                    end
                end
        end
        return shapeData
    end
 
function physics:getFixtureId(name, index)
                return self.data[name][index].pe_fixture_id
end
 
return physics;
end
 
return M
[/lua]
 
The physics bodies that are formed appear to be perfect as observed by the physics debug mode.  They perform as expected with no surprises even after scaling them with 2 display groups.  The only problem so far seems to be the error message itself - constantly clogging my build panel.