title: Shadows in SceneKit
body: <p>On my scene I've got an ambient light and an omni light, none of which casts a shadow. My game works a bit like temple run, with a player constantly advancing along the z-axis. I want to add a light that shines form left to right, parallel to the z-axis, casting a shadow on every single node from the left to the right, a bit like in this game:</p>
  
  <p><a href="https://i.stack.imgur.com/goH25.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/goH25.png" alt="enter image description here"></a></p>
  
  <p>I tried using a SCNLight of type "Spot", but then the light comes from a particular point in space. I tried the directional lighting, but all I can manage to get is a light that shines from back to forward and creates very long shadows. It would be great if I could change the shadow length and the orientation of the light. I tried doing this:</p>
  
  <pre><code>spotLight.type = SCNLightTypeDirectional
      spotLight.castsShadow = true
      spotLight.shadowMode = SCNShadowMode.Deferred
      spotlightNode.light = spotLight
      spotlightNode.orientation = SCNQuaternion(0.0, 0.0, 1.0, 0.0)
      rootNode.addChildNode(spotlightNode)
  </code></pre>