I am trying to make a VirtualObject, in Apple's new ARKit, rotate. I want the object to rotate infinitely until it is stopped. I have tried multiple things, such as:
angleDegrees = Int(((object.eulerAngles.y) * 180) / Float.pi) % 360
object.eulerAngles.y = initialObjectAngle + amoutnToSpinPerSpin
... but nothing seemed to work. I have the virtual object setup and with a press of a button, I would like the object to spin.
How can I achieve that?
Remember that ARKit is not a rendering / display technology. The main thing ARKit does for you is set things up so that whatever graphics technology you choose — SceneKit, Unity, your own custom engine, etc — can easily render on top of the camera feed in a way that makes for good AR experiences. So any question about how to draw or animate AR content is really a question about whichever display technology you're using.
That looks like SceneKit in this case. Have you looked at the (admittedly rather sparse) documentation for SceneKit, which includes its several ways to do animation? There's also sample code attached to the SceneKit WWDC session from this year (and years past) that demonstrates... well, a whole lot of things, but there are continuous spinning animations in there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With