0 Replies
      Latest reply on Dec 5, 2018 2:31 AM by Winsche
      Winsche Level 1 Level 1 (0 points)

        Hey All,

         

        I have a dilemma difficult to solve in ARKit and I am hoping someone here will be able to help me.

         

        I am trying to rotate image inside a cylinder that has entrance for the portal in front, therefore cannot rotate the cylinder itself. Is there a method of rotating image inside the cylinder around I have used

        func addWalls(nodeName: String, portalNode: SCNNode, imageName: String){
        let child = portalNode.childNode(withName: nodeName, recursively: true)
        child?.geometry?.firstMaterial?.diffuse.contents = UIImage(named: "Portal.scnassets/\(imageName).jpg")
        
        let translation = SCNMatrix4MakeTranslation(0, -1, 0)
        let rotation = SCNMatrix4MakeRotation(Float.pi / 1, 1, 0, 0)
        let transform = SCNMatrix4Mult(translation, rotation)
        child?.geometry?.firstMaterial?.diffuse.contentsTransform = transform
        child?.renderingOrder = 200
        
        if let mask = child?.childNode(withName: "mask", recursively: false){
          mask.geometry?.firstMaterial?.transparency = 0.000001
        }

         

        although it only rotates the image around its own axis. I want to move the image 180 degrees around the cylinder axis so the connection seem is above the entrance. I do not seem to find the right method for it.

        Can anyone help?