It is unclear to me how the whole thing has to be implemented in SwiftUI.
Currently:
After an input (for example moving the camera) the renderer function is called correctly.
Goal:
The renderer function should also be called without needing input.
Setup:
struct ContentView: View {
@ObservedObject var gameData : GameViewModel
var body: some View {
SceneView(
scene: gameData.scene,
pointOfView: gameData.camera,
options: [
.allowsCameraControl
],
delegate: gameData
)
}
}
class GameViewModel: NSObject, ObservableObject { ... }
extension GameViewModel: SCNSceneRendererDelegate {
func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) { ... }
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Setup: For displaying 3D elements Scenekit is used. For 2D elements Spritekit.
SceneView() is used to display a scene.
An SCNScene and an SCNNode for the camera are given.
Goal:
Now I want to put a 2D overlay over the SCNScene. Previously this could be achieved using the overlaySKScene property of the SCNView. But now that in SwiftUI only the scene and camera are given I wonder how this can be achieved.
Thanks already in advance.