I have a SCNNode, and an SCNCamera. The camera is located up and in front of the node, and looks down on the node via an SCNLookAtConstraint that I have setup. However when the node moves laterally, the camera only rotates, instead of moving with the it. Is there any way to get the camera to move with the node?
3 Answers
You are only using SCNLookAtConstraint
, which as its name says, make the camera Look At the object only. (You only need to rotate your head to look at something)
To make the Camera move with it, you will need either a SCNTransformConstraint
(documentation here), or simply make the Camera Node a child of the object you want it to follow.
In case you want the Camera to smoothly follow the object, and be constrained only by a distance (as if it was dragged by a rope), the SCNTransformConstraint
is the way to go.

- 2,904
- 1
- 13
- 23
If the transform between your node and the camera is always the same, you should consider making the camera a child node of your node. This is way more efficient and simpler than using constraints.

- 13,049
- 2
- 23
- 40
I made my camera node a child of the SCNNode I wanted to follow. That's another way to achieve this.

- 8,888
- 16
- 67
- 108