0

Here below is my code, i am trying to add shadow underneath object but not showing up.

public func addNode(locationNode:LocationNode) {

        locationNode.position = SCNVector3Make(locationNode.x, locationNode.y,locationNode.z)
        self.sceneNode?.scale = SCNVector3(x: 0.4, y: 0.4, z: 0.4)

        let light = SCNLight()
        light.type = .directional
        light.castsShadow = true
        light.shadowRadius = 200
        light.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
        light.shadowMode = .deferred
        let constraint = SCNLookAtConstraint(target: locationNode)
        lightNode = SCNNode()
        lightNode!.light = light
        lightNode!.position = SCNVector3(locationNode.x + 0.5, locationNode.y + 0.5, locationNode.z)
        lightNode!.constraints = [constraint]
        self.sceneNode?.addChildNode(lightNode!)
        self.sceneNode?.addChildNode(locationNode)
    }

Here is the screen shot enter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579
imjaydeep
  • 878
  • 1
  • 11
  • 34

0 Answers0