SceneKit or RealityKit for Non-AR Game Development

Hi everyone,

I'm choosing a framework for developing a game that doesn't involve augmented reality (AR) and I'm unsure whether to use SceneKit or RealityKit. I would like to hear from Apple engineers on this matter. Which of these frameworks is better suited for creating non-AR games?

Additionally, I'd like to know if it's possible to disable AR in RealityKit using the updated RealityView? Thanks in advance for your insights and recommendations!

Answered by iokey in 791332022

Hi again everyone,

I searched through the documentation and found that the content in RealityView can be of type RealityViewContent for visionOS or RealityViewCameraContent for iOS and macOS. The latter has a camera property that can be set to virtual. Here's the code I came up with.

import SwiftUI
import RealityKit

struct ContentView: View {
    var body: some View {
        RealityView { content in
            content.camera = .virtual
        }
    }
}

This sets the camera mode to virtual, which I believe should disable AR features. However, since this is a beta version and the documentation isn't entirely clear, I’m not completely sure if this is the right solution, so please don't rely solely on my code.

Thanks again everyone!

Not Apple engineer here but do have an opinion. Up until this WWDC I would have said RealityKit still isn't up to par with SceneKit, but they seemingly have narrowed the gap this year.

Now with the proper collision detection and exposed skeletal information, you can do pretty much everything SceneKit can do.

That said, if you plan on using GamePlayKit, you will probably still want to use SceneKit as it would get awkward and might not really be possible to get good results with RealityKit.

To get RealityKit to not function as AR, all you have to do is set the ARView camera mode to .nonAR: https://developer.apple.com/documentation/realitykit/arview/cameramode-swift.enum

You now also have the option of utilizing RealityView directly in SwiftUI.

Accepted Answer

Hi again everyone,

I searched through the documentation and found that the content in RealityView can be of type RealityViewContent for visionOS or RealityViewCameraContent for iOS and macOS. The latter has a camera property that can be set to virtual. Here's the code I came up with.

import SwiftUI
import RealityKit

struct ContentView: View {
    var body: some View {
        RealityView { content in
            content.camera = .virtual
        }
    }
}

This sets the camera mode to virtual, which I believe should disable AR features. However, since this is a beta version and the documentation isn't entirely clear, I’m not completely sure if this is the right solution, so please don't rely solely on my code.

Thanks again everyone!

SceneKit or RealityKit for Non-AR Game Development
 
 
Q