SpriteKit bodyWithTexture gap between sprites when colliding -


i'm new spritekit , i'm trying create game, blocks fall top of screen , land on bottom of screen or on top of block. here sample code gamescene.m:

- (void)didmovetoview:(skview *)view  {     self.size = cgsizemake(view.frame.size.width, view.frame.size.height);     self.backgroundcolor = [uicolor whitecolor];     self.physicsbody = [skphysicsbody bodywithedgeloopfromrect:self.frame];      skspritenode *redrect = [skspritenode spritenodewithimagenamed:@"redrect"];     redrect.position = cgpointmake(cgrectgetmidx(self.frame), self.frame.size.height);     redrect.physicsbody = [skphysicsbody bodywithtexture:redrect.texture size:redrect.texture.size];     redrect.physicsbody.affectedbygravity = yes;      skspritenode *bluerect = [skspritenode spritenodewithimagenamed:@"bluerect"];     bluerect.position = cgpointmake(cgrectgetmidx(self.frame), self.frame.size.height);     bluerect.physicsbody = [skphysicsbody bodywithtexture:bluerect.texture size:bluerect.texture.size];     bluerect.physicsbody.affectedbygravity = yes;      [self addchild:redrect];     [self addchild:bluerect]; } 

as can see on screenshot, there gap between 2 blocks , between red block , ground. happens when rects collide each other or ground. instance, if use skaction movetoy: moves block bottom of screen, gap disappears. how can rid of these gaps when nodes collide?

enter image description here

i totally sure problem texture images, not precisely cropped or created.

spritekit engine never creates gaps between nodes.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo