I placed 3d object to ARViewController after 3 seconds of placing object, then I want to rotate object by 90degree
arView.scene.addAnchor(anchorEntity)
DispatchQueue.main.asyncAfter(deadline: .now() + 3){
print("after 3 sec ! ")
let radians = 90.0 * Float.pi / 180.0
anchorEntity.orientation = simd_quatf(angle: radians, axis: SIMD3(x: 0, y: 1, z: 0))
}
it works very well but the problem is that I want to smooth rotation , as you can see short video, it suddenly rotate which seem weird.
how can I do this ?
https://youtu.be/Ixk2elm-bfU
You do not define any animation, just ask to rotate by π/2.
So it does what you ask for.
Have a look here on how to achieve:
https://stackoverflow.com/questions/59335075/how-to-animate-a-transform-in-realitykit
Note: you could simplify radians with
let radians = Float.pi / 2.0