I'm using 3 SCNRenderers to render the same game scene from 3 different perspectives. It's a third person shooting game. A day before, I found that when all the renderers were working, the main hero's walking animation disappeared, but I could still control him to move. Then I found this: https://forums.developer.apple.com/thread/66890. By setting the render function's atTime with CFAbsoluteTimeGetCurrent(), the animation did appear. However, when the hero was running 2 animations, for example, firing while walking, the rendered result only showed 1 of them.
I did solved the problem by saving the time which was given by the SCNView's render function, and then applied it to each renderer's render function. Here is my solution sample:
var globeTime:TimeInterval = 0
//the SCNView's render function:
func renderer(_ aRenderer: SCNSceneRenderer,
updateAtTime time: TimeInterval) {
globeTime = time
//...
}
//each renderer's render function:
renderer.render(atTime: globeTime,
viewport: viewport,
commandBuffer: commandBuffer,
passDescriptor: renderPassDescriptor)
I successfully make those renderers render the right thing. However, weird things start to happen. Sometimes, when it's time for an animation or a SCNTransaction to begin, nothing happens. All the animations and SCNTransactions just pause in their initial state. But the game is still running, which means I can still control my hero to move and jump without any animations. After a few seconds, the paused animations and SCNTransactions start.
I have no idea what causes this. I've checked those model's isPaused property as well as the SCNView and the SCNRenderer's isPlaying and loops property. Still, I cannot figure out why. Can anyone help me? Thanks.