Monday, May 11, 2026
HomeiOS Developmentios - Pause/Play animation in SceneView SwiftUI

ios – Pause/Play animation in SceneView SwiftUI

[ad_1]

I’m attempting to pause and resume the animation of a 3D scene in SwiftUI, utilizing isPaused however unsure why it would not pause or resume the scene’s animation. Right here is the code:

var scene: SCNScene? {
        let scene = SCNScene(named: "mannequin.dae")
        scene?.rootNode.scale = SCNVector3(0.6, 0.6, 0.6)
        return scene
    }

var physique: some View {

     VStack {

          SceneView(
                scene: scene,
                pointOfView: cameraNode,
                choices: [.allowsCameraControl, .autoenablesDefaultLighting]
                )


  Button("Pause") {
      scene?.isPaused = false 
    }

  }
}

I attempted scene?.rootNode.isPaused however nonetheless nothing occurred, any assist can be nice.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments