1

I have imported a Collada file into my scene and I am using allowsCameraControl to rotate / pan the object / pan the object

I now need functionality to jump instantly to the front or side view of the object.

Does anybody know how I can get the camera that Scenekit implements in my scene and how to rotate this camera to show the front and back view ?

Vilois
  • 33
  • 3

1 Answers1

1

"Front view" and "side view" are notions that are defined in terms of your content, so you have to define them yourself.

  1. Create a node (let's call it "frontViewNode" for example) with an attached SCNCamera and position/orient it so that it's looking at whatever you call the "front" of your object. See this answer if you need help with that.
  2. Create another node ("sideViewNode") that's looking at whatever you call the "side" of your object.
  3. When you want to switch views, set the pointOfView property on the SCNView displaying your scene to either your "frontViewNode" or your "sideViewNode". You can even do this inside an animation (see SCNTransaction) to make the camera view swoop around between the two viewpoints.
Community
  • 1
  • 1
rickster
  • 124,678
  • 26
  • 272
  • 326