The following 20 line program crashes the Corona Game Edition 2010.109 simulator when I try to create a display object and try to add it to the physics engine inside of a “collision” event handler:
[lua]local physics = require(“physics”)
physics.start()
physics.setScale( 60 )
physics.setGravity( 0, 10 )
–physics.setDrawMode(“debug”)
local ground = display.newRect( 0, display.contentHeight-20, display.contentWidth, 20 )
physics.addBody( ground, “static”, { friction=0.5 } )
local nc0 = display.newCircle( 150, 50 , 25 )
nc0:setFillColor( 255, 255, 0)
physics.addBody( nc0, { density=1, friction=0.5, bounce=0.5, radius=25 } )
local function onGlobalCollision( event )
local nc1 = display.newCircle( 50, 50 , 25 )
nc1:setFillColor( 0, 255, 0)
physics.addBody( nc1, { density=1, friction=0.5, bounce=0.5, radius=25 } )
end
Runtime:addEventListener( “collision”, onGlobalCollision )[/lua]
Hopefully the following console output with some details about the assertion failure is helpful:
Copyright (C) 2009-2010 A n s c a , I n c .
Version: 1.0.0
Build: 2010.109
The file sandbox for this project is located at the following folder:
(/Users/franks/Library/Application Support/Corona Simulator/Worm6-add-BEEE207118EEE1847DB4E01F5289DB3A)
Assertion failed: (IsLocked() == false), function CreateBody, file /Users/ansca/.hudson/jobs/Pong-DMG/workspace/platform/mac/../../external/Box2D\_v2.1.2/Box2D/Box2D/Dynamics/b2World.cpp, line 84.
/Applications/Corona Game Edition 2010.109/simulator: line 9: 19252 Abort trap "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\*
~\>
This same bug has been haunting me in the previous game edition releases, but I wasn’t able to isolate it because of the now-fixed, debug draw mode bus-error.
Please confirm that this is a bug… and that I’m not doing anything “wrong”.
Thanks, Frank.
[import]uid: 8093 topic_id: 2662 reply_id: 302662[/import]