Chipmunk static SegementShape efficiency problem
Posted: Fri Mar 30, 2012 9:00 pm
I was trying to make a game like "where is my water" through chipmunk.
I've already add the water(the bodies) and the mud(something can be removed from the screen).
Here is my problem, when removing the mud, I add at least 8 lines(through this function, AddSegementShapeToSpace() ) which forms an polygon to the space.
and when trying to remove more mud, more and more static segmentshape were added to the space.
thus created an efficiency problem. It has 15-18 fps at beginning , as we add more polygons, the fps drops down to 3-5, which is unacceptable. Here is the pseudo code:
// Every frame
Chipmunk is the first physics engine I met and I think it is awesome. It runs on the MTK platform. I have an arm cpu has 400MHZ, and enough memory.
forgive my poor english.
thanks, guys..
I've already add the water(the bodies) and the mud(something can be removed from the screen).
Here is my problem, when removing the mud, I add at least 8 lines(through this function, AddSegementShapeToSpace() ) which forms an polygon to the space.
and when trying to remove more mud, more and more static segmentshape were added to the space.
thus created an efficiency problem. It has 15-18 fps at beginning , as we add more polygons, the fps drops down to 3-5, which is unacceptable. Here is the pseudo code:
// Every frame
Code: Select all
if (userTouchScreen)
{
updatePolygons(); // this produce a lot of points.
}
cpSpaceEachShape(, RemoveShape,); // removes all the shape
foreach line in polygon: // more and more static shapes were added to space.
all line to space. //AddSegementShapeToSpace()
stepSpace;
Chipmunk is the first physics engine I met and I think it is awesome. It runs on the MTK platform. I have an arm cpu has 400MHZ, and enough memory.
forgive my poor english.
thanks, guys..