我正在尝试以恒定的速度放下 SKSpriteNode 而不会弹跳。
这是我正在使用的代码:
SKSpriteNode *floor = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(self.size.width, 1)];
floor.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:floor.size];
floor.physicsBody.restitution = 0.0f;
floor.physicsBody.dynamic = NO;
floor.physicsBody.allowsRotation = NO;
SKSpriteNode* block = [SKSpriteNode spriteNodeWithTexture:[SKTexture textureWithImageNamed:imageName]];
block.position = CGPointMake(160, 300);
block.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(block.size.width - 2, block.size.height)];
block.physicsBody.dynamic = dynamic;
block.physicsBody.restitution = 0.0f;
block.physicsBody.allowsRotation = NO;
当我改变恢复值时,我可以看到块反弹的差异,但是当它为零时,它仍然会反弹一点。当多个块堆叠时,下面的块也会反弹一点。
我怎样才能完全禁用弹跳?