Posts

Post not yet marked as solved
1 Replies
1.1k Views
Let's say I have game levels: level_1.scn, level_2.scn, level_3.scn and so on. What's the best way to go from the current level to the next level if the player has completed the level?Here's what I tried:extension GameViewController: SCNPhysicsContactDelegate { func physicsWorld(_ world: SCNPhysicsWorld, didEnd contact: SCNPhysicsContact) { guard let nodeA = contact.nodeA.name else { return } guard let nodeB = contact.nodeB.name else { return } if nodeA == "player" && nodeB == "finishLine" || nodeA == "finishLine" && nodeB == "player" { if let scene = SCNScene(named: "scenes.scnassets/level_2.scn") { sceneView.present(scene, with: .fade(withDuration: 0.25), incomingPointOfView: nil, completionHandler: nil) } } } }Once this part of the code is executed, the scene is changed, but with a significant delay. My levels are pretty simple and I don't think they should be loaded for more than 1 second. And after the scene changes, I lose the ability to control the player.Looks like I'm doing something wrong. Because the console displays a warning: Scene is modified within a rendering callback of another scene (). This is not allowed and may lead to a crash.How to create the correct logic for changing scenes?
Posted
by 1nd3e.
Last updated
.
Post not yet marked as solved
0 Replies
387 Views
Let's say I have N-numbers of levels. Each level contains nodes of the same type. If I create nodes in separate .scn files and add them to the scenes as Reference Type nodes, how will this affect on performance? Positive or negative? My guess is that this approach will have a positive affect on performance, because once a node is loaded, the app will need less time to load the node when the same node appears on scene, as we have loaded a node of this type (design) before. Isn't that right? Or not? Although, maybe, Reference Type nodes are only helpful because I do not have to repeat the same work each time.
Posted
by 1nd3e.
Last updated
.