我在和SKLightNode玩。我正在尝试创建阴影,这样看起来就像太阳在正午。所以基本上是这样的:
但是,我能让SKLightNode为我呈现的只有以下内容:
所以问题是,它看起来像是来自物体旁边的光,并且来自相同的水平。
我已经尝试过SKLightNode配置,但这就是我目前所拥有的(我尝试了许多配置,但似乎没有任何效果)
var light = SKLightNode()
//testing lightnodes
light.name = "light"
light.categoryBitMask = 3
light.position = point
light.zPosition = 100.0
light.falloff = 100.00;
light.enabled = true
light.lightColor = UIColor(red: 86/255, green: 128/255, blue: 45/255, alpha: 0.5) //initWithRed:1.0 green:1.0 blue:0.0 alpha:0.5];
light.shadowColor = UIColor(red: 220/255, green: 220/255, blue: 220/255, alpha: 0.3)//[[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.3];
light.ambientColor = UIColor(red: 220/255, green: 220/255, blue: 220/255, alpha: 0.3)//[[UIColor alloc] initWithRed:0.0
addChild(light)
发布于 2015-03-07 20:17:55
你不能用SKLightNode达到你想要的效果。请记住,SK是一个2D平台。你想要的效果是3D的。通过使用位置偏移和自定义alpha设置向节点添加子对象,可能可以获得所需的效果。
https://stackoverflow.com/questions/28919411
复制