Animating scene animation and notes in SceneKit

I move the camera node of my SCNScene along the z axis using the following code:

let moveTo = SCNAction.moveTo(SCNVector3(x:0,y:0,z:-40), duration: 40); 
cameraNode.runAction(moveTo)

      

I would like the event (like a GameOver event fired by my game) to be smoothly slow down the camera until you stop it.

How can you smoothly stop the camera movement?

+3


source to share


2 answers


SCNAction has a "timingMode" property that you can set to "EaseOut"



+1


source


Worried, but you can use physics:



At the moment the GameOver event fires, add a dynamic physics body to the camera node, give it the current camera speed and apply damping to slow it down. It will also give tremendous control over the slowdown. Just make sure the node is not subject to gravity, as this will see it fall without grace.

0


source







All Articles