Search code examples
scenekit

Rotate camera around player


In SceneKit how to make the camera automatically follow the player and how to make the player turn the camera around him with the gamePadRight?

Thank you!


Solution

  • To have the camera follow the player consider you to use SCNContraint (Position and LookAt).

    To make a camera turn around the Player you could use a separate Camera Object-(Node) that only focuses the player (also using SCNContraint) - then create a center Node and add the new camera Node to the center node at the desired distance. Add the center Node to the player Node and let it rotate using i.Ex. a SCNAction. also change the Point of view to the new camera that should rotate.