Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop / Pause .runActionForever() SCNAction

How do I pause or stop a SCNAction that was called by .runActionForever() without a key? I saw the option to use node.removeActionForKey("action") but my SCNAction does not have a key. This is how I create it:

var turnAction = SCNAction.rotateByX(0, y: 1, z: 0, duration: 1)

...and how it is used:

node.runAction(SCNAction.repeatActionForever(turnAction))

What I tried

I know there is the method node.removeActionForKey("action") but when I create a keyValue for my SCNAction it gets void and can no longer be used with .repeatActionForever().

How can I stop it?
Thanks in advance :)

like image 968
LinusGeffarth Avatar asked Apr 18 '15 06:04

LinusGeffarth


1 Answers

To add an action with a key you use the

SCNNode.runAction(SCNAction, forKey: String)

method.

Now you can remove a specific action by that key

SCNNode.removeAction(forKey: String)
like image 196
Arbitur Avatar answered Nov 15 '22 08:11

Arbitur