To rotate the car node you can just adjust the eulerAngles until the car is facing the camera.
node?.eulerAngles = SCNVector3Make(0,Float(degToRadians(degrees:180 )),Float(degToRadians(degrees: 90)))
rotated this van around to front facing.
eulerAngles are in radians, so a handy conversion to degrees:
public func degToRadians(degrees:Double) -> Double
{
return degrees * (M_PI / 180);
}
You can also do the same rotation on the van node using an animation
let rotate = SCNAction.rotateBy(x: CGFloat(degToRadians(degrees: -90)), y: 0, z: 0, duration: 1)
node.runAction(rotate)
You can use SCNLookAtConstraint which follows the pointOfView along the negative z-axis of the parentNode.
So if the car’s negative z-axis is the camera facing the side doors... as you rotate the camera, around the car.... the car will swivel always maintaining that view.
let constraint = SCNLookAtConstraint(target:sceneView.pointOfView)
constraint.isGimbalLockEnabled = true
node.constraints = [constraint]
Inside Xcode, the screenshot below shows how you can change the rotation of the van using the euler angles (highlighted in red). The view should be “front” camera (also highlighted in red). The animation can also be done inside Xcode via the animation panel, select “rotate Action” & drag into the Actions timeline in the bottom -middle