5 Replies
      Latest reply on Apr 5, 2020 7:10 AM by Behr
      G.U.T.explorer Level 1 Level 1 (0 points)

        I have developed an app using SceneKit since Swift came out.  Now SwiftUI is out and uses structs rather than classes.  SceneKit is a cascade of classes.  As a newbie, I am concerned that my code might be obsolete through depreciations soon after publication and I'd rather get ahead of the issues now. 

         

        So, is SceneKit long-term viable?

         

        My first attempts at converting my custom classes to structs seems impossible without Apple leading the way.  If I understand correctly, I can make a struct whose only member is an instance of a class, but the benefits of the struct, e.g., minimal memory, processing time, etc., are lost.

        • Re: SceneKits future
          Bobjt Apple Staff Apple Staff (100 points)

          If you want to go ultra modern and start an app that's Swift-only, note that you can begin using RealityKit in replacement of SceneKit. If you're not interested in AR use-cases, you can set ARView's cameraMode to .nonAR.

           

          // Don’t use an ARSession or camera pass through

          arView.cameraMode = .nonAR

            • Re: SceneKits future
              artecolote Level 1 Level 1 (0 points)

              are you implying scenekit is dead?

              • Re: SceneKits future
                Behr Level 1 Level 1 (0 points)

                Hello Bobjt and thank you for this clarification.

                 

                I was about to begin a game project and I chose Scenekit.

                I went through tutorials from RW so I would say I am Scenekit ready.

                 

                However, I find lot of clues here on the forum, on the internet also that make me think spending my time improving my scenekit skills is not worthy.

                 

                You advise to start an App using RealityKit.

                Iy makes me doubt.

                 

                I am currently beginning to learn Unity.

                 

                Would you advise me to go and learn RealityKit? And why?

                 

                Regards

                 

                Behr

                  • Re: SceneKits future
                    Bobjt Apple Staff Apple Staff (100 points)

                    There are a few considerable reasons to choose RealityKit:

                    - RealityKit is a multithreaded engine, whereas SceneKit is single threaded. At a critical point, performance differences should be noticeable.

                    - RealityKit implements a modern ECS engine (entity-component system) that makes coding more efficient.

                    - RealityKit provides a networking layer to implement state synchronization

                    - for augmented reality (AR) apps only, focus is turned to RealityKit which builds on top of the scene-mesh (ARMeshAnchors) that ARKit provides using the LiDAR scanner. SceneKit doesn't have this functionality.

                    - RealityKit is designed to provide a formidable API for AR apps on Apple platforms, but as mentioned above, you can also use it without AR.

                      • Re: SceneKits future
                        Behr Level 1 Level 1 (0 points)

                        Dear Bobjt

                         

                        Thank you for your encouraging though corporate response.

                        - performance differences seems favorable to ARKIT

                        - AR features seems very promising.

                         

                        But I tryied to use RealityKit without AR the way you present it in your first response:

                         

                        // Don’t use an ARSession or camera pass through
                             arView.cameraMode = .nonAR

                         

                        Unfortunatelly this code is raising Swift Compiler Errors at line 20.

                         

                        import UIKit
                        import RealityKit
                        
                        class ViewController: UIViewController {
                           
                            @IBOutlet var arView: ARView!
                           
                           
                            override func viewDidLoad() {
                                super.viewDidLoad()
                               
                                // Load the "Box" scene from the "Experience" Reality File
                                let boxAnchor = try! Experience.loadBox()
                               
                                // Add the box anchor to the scene
                                arView.scene.anchors.append(boxAnchor)
                            }
                           
                            func setupArView() {
                                 arView.cameraMode = .nonAR
                            }
                        }

                         

                        .../ViewController.swift:28:17: Value of type 'ARView' has no member 'cameraMode'

                        .../ViewController.swift:28:31: Cannot infer contextual base in reference to member 'nonAR'

                         

                        More over my questions would be:

                         

                        1. I intend to manage Light and Camera. I know how to do it with SCENEKIT, but I can not figure out if it is (or will be) possible with REALITYKIT ?

                        2. Can REALITYKIT and SCENEKIT be part of the same project: are they compatible?

                         

                        Regards

                         

                        Behr