'How do I rotate an object around only one axis in RealityKit?

I'm trying to rotate a cube around its z-axis but I can't find how.

Is there a way in RealityKit to do this?



Solution 1:[1]

For people who are also searching for this you need to use transform and rotation. This needs a simd_quatf where you give the angle and the axis.

In my case i had to use this:

"object".transform.rotation = simd_quatf(angle: GLKMathDegreesToRadians(90), axis: SIMD3(x: 0, y: 0, z: 1))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1