我正在玩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)
答案 0 :(得分:1)
使用SKLightNode无法达到您想要的效果。请记住,SK是一个2D平台。您想要的效果是3D。您可以通过使用位置偏移和自定义Alpha设置向您的节点添加子项来实现所需的效果。