I'm trying to correctly position another SCNode and all the examples I find are using the boundingBox property like so:
let vaseHeight = vaseNode.boundingBox.max.y - vaseNode.boundingBox.min.y
or
glassesNode.position.z = faceNode.boundingBox.max.z * 3 / 4
The problem is that doesn't exist with Objective-c and I can't find anything to replace it?
I was able to find this method
- (BOOL)getBoundingBoxMin:(SCNVector3 *)min
max:(SCNVector3 *)max;
but it returns a bool and how I can know the min and max, that's what I'm trying to find?
The Swift property is returning a tuple. The Objective-C method has two out-parameters.
getBoundingBoxMin:max:
is the correct method. The two parameters are populated as a result of the call. The BOOL
return value indicates whether the node has a non-zero volume or not.
SCNVector3 min;
SCNVector3 max;
CGFloat vaseHeight;
if ([vaseNode getBoundingBoxMin:&min max:&max]) {
// Process min and max here
vaseHeight = max.y - min.y;
} else {
// Node has a zero volume
vaseHeight = 0;
}