ios - Assertion failed when use bodyWithPolygonFromPath: method to egg shape -


i simulating physics egg shape sksprite node. however, there assertion failed error occur:

assertion failed: (edge.lengthsquared() > 1.19209290e-7f * 1.19209290e-7f), function set, file /sourcecache/physicskit_sim/physicskit-6.5.4/physicskit/box2d/collision/shapes/b2polygonshape.cpp, line 180.

the following code:

self.egg = [skspritenode spritenodewithimagenamed:image_name_egg];     [self.egg setscale:0.2];     self.egg.position = cgpointmake(self.size.width/2,self.size.height - self.egg.size.height/2);     self.egg.name = image_name_egg;      cgpoint startpoint = cgpointmake(0, self.egg.size.height*0.4);     cgpoint endpoint = cgpointmake(self.egg.size.width, startpoint.y);     cgpoint controlpointleft = cgpointmake(startpoint.x, self.egg.size.height);     cgpoint controlpointright = cgpointmake(endpoint.x, controlpointleft.y);       cgmutablepathref pathref = cgpathcreatemutable();             cgpathmovetopoint(pathref, null, startpoint.x, startpoint.y);     cgpathaddquadcurvetopoint(pathref, null, controlpointleft.x, controlpointleft.y, self.egg.size.width/2, controlpointleft.y);     cgpathaddquadcurvetopoint(pathref, null, controlpointright.x, controlpointright.y, endpoint.x,endpoint.y);     cgpathaddarc(pathref, null, self.egg.size.width/2, startpoint.y, self.egg.size.width/2, 0, m_pi, no);      self.egg.physicsbody = [skphysicsbody bodywithpolygonfrompath:pathref];     self.egg.physicsbody.dynamic = yes;     self.egg.physicsbody.categorybitmask = eggcategory;     self.egg.physicsbody.contacttestbitmask = rabbitcategory;     self.egg.physicsbody.collisionbitmask = rabbitcategory;     self.egg.physicsbody.allowsrotation = yes;     [self addchild:self.egg]; 

what's wrong? can me fix? thank much!

according assertion, 1 of edges shorter minimum size expected sprite kit.

assertion failed: (edge.lengthsquared() > 1.19209290e-7f * 1.19209290e-7f) 

check path coordinates , ensure it's not small.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -