How to reset SCNConstraints

Hi,

I am using SCNConstraints to zoom in on a geometry the user clicked, but would like to reset to my original position when the user clicks outside.

How do I reset my Camera to its original position?
I read constraints are changing the transform, but the position, transform and everything is unchanged. Yet when I set
Code Block
constraints = nil

nothing happens the camera stays where it last was and does not move and everything it contains claims a different position. even the world transform shows it's unchanged.

How do I reset a camera node to it's origin after I removed all constraints???

An SCNConstraint only limits the movement of an SCNNode. Once removed, it doesn't do anything to the existing position of an SCNNode. How about saving the original position of the camera in a variable and setting the camera's position back to the contents of that variable at the time you want to remove the constraints? The camera node's position when using simd computation is a simd_float3.

Such as:
Code Block
let originalPosition = cameraNode.simdPosition;


Then later:
Code Block
cameraNode.constraints?.removeAll();
cameraNode.simdPosition = originalPosition;


How to reset SCNConstraints
 
 
Q