SceneKit: SCNAnimationPlayer re-trigger animationDidStop

I have this code:

var animationPlayer = loadAnimationFrom("ANIMATION_TO_LOAD")
animationPlayer.animation.isRemovedOnCompletion = false
animationPlayer.animation.animationDidStop = { [unowned self] (_, _, _) in
 // execute when animation end
}

When i execute play animationPlayer.play(). The animation works and it trigger animationDidStop. The problem is when i call animationPlayer.play() again, animationDidStop don’t get call no more.

@chrislanguage Can you please help with this when you get a chance? Thank you - much appreciated! :]

What I end up doing is instead of listening for animationDidStop, once I trigger play is this:

animationPlayer.play()
DispatchQueue.main.asyncAfter(deadline: .now() + animationPlayer.animation.duration, execute: {
// execute when animation end
})

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.