Wednesday, December 3, 2008

Problems with Glaze

space invaders strike backImage by gnackgnackgnack via FlickrI ran into a problem recently while programming a game with Glaze. I was trying to toggle 2 different GeometricShapes in a RigidBody. I was removing one of the shapes and then adding the other one. Next time it would switch back. The problem was Flash would crash. I would get this error:

Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at org.rje.glaze.engine.collision.shapes::Polygon/UpdateShape()[C:\dev\projects\clients\thrust\projects\Glaze\src\org\rje\glaze\engine\collision\shapes\Polygon.as:123]
at org.rje.glaze.engine.collision.shapes::GeometricShape/Update()[C:\dev\projects\clients\thrust\projects\Glaze\src\org\rje\glaze\engine\collision\shapes\GeometricShape.as:143]
at org.rje.glaze.engine.space::Space/physicsStep()[C:\dev\projects\clients\thrust\projects\Glaze\src\org\rje\glaze\engine\space\Space.as:202]
at org.rje.glaze.engine.space::Space/step()[C:\dev\projects\clients\thrust\projects\Glaze\src\org\rje\glaze\engine\space\Space.as:165]


This was bad. I had no clue what it was for a long time. I had one of my colleagues try tinkering with it and he stumbled on a way to fix it. It seems that you can't really reuse the same GeometricShape once you've added it to the Space. I believe that all Shapes get an id of some sort and it seems that adding the same object that was already removed probably reuses that same id. So I basically have to create a new GeometricShape each time I want to add it to the RigidBody.

0 comments: