I'm developing a 2D game with the new API Sprite Kit. The problem is that although setting the restitution of a sprite node to 0, it bounces a little bit. How can I totally disable the bouncing?
You need to set the restitution on both the objects that will meet.
self.world = [SKNode node];
[self addChild:self.world];
self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];
self.physicsBody = [SKPhysicsBody bodyWithEdgeFromPoint:CGPointZero toPoint:CGPointMake(500, 0)];
self.physicsBody.restitution = 0.0;
self.ball = [SKSpriteNode spriteNodeWithColor:[SKColor redColor] size:CGSizeMake(40, 40)];
self.ball.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(40, 40)];
self.ball.physicsBody.density = 100;
self.ball.physicsBody.restitution = 0.0;
self.ball.position = CGPointMake(200, 300);
[self.world addChild:self.ball];