Search code examples
xamarin3dxamarin.iosscenekit

How to allow only X axis rotation of 3D model? (SceneKit)


I've an app that should show a 3D model, at this point all is OK, but this model rotates in all 3D space axis and I need that this model rotate only on X axis (left/right) when user tries rotate the model.

Any idea? I've been stuck here for a while...


Solution

  • Provide your own camera. Don't use the "allows camera control" checkbox in Interface Builder, and leave the view's allowsCameraControl property set to false.

    You said "X axis (left/right)". But in SceneKit, the X axis runs left to right, so rotating left/right is a rotation around the Y axis. Add a swipe gesture recognizer to recognize swipes left and right. Use the recognizer's handler to rotate your model around the Y axis as the user's finger slides left and right.