scnaction

In SceneKit SCNAction hangs when called from completion handler of RunAction

纵然是瞬间 提交于 2019-12-13 04:27:38
问题 Calling an SCNAction from the completion handler of RunAction seems to hang SceneKit. A touch event or rotating the device seems to unblock the hang. To reproduce: 1) Take the default SceneKit project you get on startup with the rotating spaceship. 2) Replace the animation code: ship.RunAction(SCNAction.RepeatActionForever(SCNAction.RotateBy(0, 2, 0, 1))); with: ship.RunAction(SCNAction.RotateBy(0, 2, 0, durationInSeconds: 3.0f), delegate { Console.WriteLine("DONE ROTATE"); ship.RunAction

SCNAction to change color of node works once, then never again

走远了吗. 提交于 2019-12-13 03:49:45
问题 Still getting my bearings with Swift, be gentle ;-) I have set up an action to change the color of a node, which I call every few seconds. It works like a charm on the first call, but after that the color remains the same. My code: let duration: TimeInterval = 3 var myRed = 255 var myGreen = 0 var myBlue = 0 var voltage: UInt32 = 0 { willSet(newV) { } didSet { myGreen = Int.random(in: 0...255) let act1 = SCNAction.customAction(duration: duration, action: { (node, elapsedTime) in let