S
S
Stanislav Korolevskiy2017-06-04 21:34:14
Swift
Stanislav Korolevskiy, 2017-06-04 21:34:14

How to rotate an object on each click of a button?

There is a scene with boxes. It is necessary to rotate the selected box with each click on the button. Now the box rotates only on the first click on the button. Subsequent presses do not respond.

let angle = SCNVector4(1, 0, 0, 90*(Double.pi/180))
    
    func buttonAction(sender: UIButton!) {
        cubes.boxOne.runAction(SCNAction.rotate(toAxisAngle: angle, duration: 1))
        print(cubes.boxOne.rotation)
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question