-1

Background: I have an app presenting a 3D model with SceneKit. By default SceneKit has a function that once the user makes a double-tap, the 3D model returns into its original position. I want to use this feature programmatically. When the user hits a certain button, the 3D model shall return to its original position. Therefore, I would like to fire a double-tap event if possible and hope that the 3D model will react accordingly. How can this be done?

This question relates to another case How to retrieve information about the camera position in a sceneKit project when the 3D model is zoomed? in which I try to resolve this task by setting the cameranode positions to their original value. But obviously this is not possible. The fake of the double-click would be a kind of work around in order to achieve the requirement for my application.

Peter Mattheisen
  • 117
  • 2
  • 13

1 Answers1

0

As mentioned in https://stackoverflow.com/a/24768474/2997825 and https://stackoverflow.com/a/70779030/2997825 SceneKit will create a new node and set it as the point of view when an interaction starts.

To revert to the original camera, you can simply set the pointOfView property back to the original, untouched, camera node.

mnuages
  • 13,049
  • 2
  • 23
  • 40
  • I have tried to realize a solution with the pointOfView parameters. However these tests confirmed that the postion.z is not changed by a zoom and does also not react to changes. This is different from position.x and position.y. I am currently working on an old Xcode 10 environment due to hardware restrictions. I have ordered a new iMac and will soon be able to use Xcode 14. Then I will make this test again and make a further comment here. – Peter Mattheisen Jan 27 '22 at 17:34