-1

I have a planeNode in a SceneKit Scene which I want to control. For this I want to constantly update the Orientation. Due to the Singularities of Euler Angles I am using Quaternions. So far I am directly updating planeNode.orientation and it works fine. The only issue is that due to the update rate it slightly jumps between orientations, which does not look very nice. I tried using SCNActions but the problem is I can only rotateTo and rotate by Euler Angles. Is there any way to rotateTo Quaternions?

Any help is very welcome! Thanks!

alexismue
  • 29
  • 5

1 Answers1

1

I solved it by up using sims_slerp and therefore not updating the orientation directly to the new set point orientation but rather to a part of it:

let qSlerp = simd_slerp(simd_quatf(quat: self.planeNode.orientation), self.orientationSP!, 0.1)
// UPDATE ORIENTATION TO CLOSEST INTERPOLATION
self.planeNode.orientation = SCNQuaternion(simd_quat: qSlerp)}
alexismue
  • 29
  • 5