我的光:
self.light = [[SKLightNode alloc] init];
self.light.categoryBitMask = 0;
self.light.falloff = 1;
self.light.ambientColor = [UIColor whiteColor];
self.light.lightColor = [[UIColor alloc] initWithRed:1.0 green:1.0 blue:0.0 alpha:0.5];
self.light.shadowColor = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.3];
self.light.zPosition = 200;
[self.world addChild:self.light];在“更新”上,我将光线位置更改为字符位置。
我什么都试过了,只是看不见我的光。
发布于 2015-10-21 23:17:33
在场景中添加一盏灯并不会增加一个白色的圆圈,一个灯泡,或者类似的东西,它只会用那盏灯照亮一切。所以你不会“看到光”,只会看到它的效果。
如果你想看到光线投射的阴影,你必须激活每个必须投阴影的物体的阴影。您可以通过以下方法为您的SKNode执行此操作:
yourSKNode.shadowCastBitMask = 1最后,如果您想要在类似背景的东西上产生凸点效应,则必须使用以下方法创建背景:
let background = SKSpriteNode(imageNamed: "theName", normalMapped: true)
background.lightingBitMask = 1https://stackoverflow.com/questions/33258793
复制相似问题