问题
I'm trying to wrap an SCNPlane around a SCNNode. I'm using ARKit so everything is measured in meters, but when I get the boundingBox
, I get measurements in some other unit. I looked at Apple's documentation, and they don't specify what the units are.
For example, one of nodes is roughly 3 meters wide, but it says its 26 units.
I could do a rough division to get a constant and use that to do the unit conversions, but I was wondering if there's a less hacky way to do it?
let textContainerSize = textBodyNode.boundingBox
let xSize = textContainerSize.max.x - textContainerSize.min.x
let ySize = textContainerSize.max.y - textContainerSize.min.y
print("size")
print(xSize, ySize) // <-- returns (26,2)
let planeGeometry = SCNPlane(width: xSize, height: ySize)
回答1:
One SceneKit unit is one meter in ARKit
but the boundingBox is defined in the nodes local coordinate system. So your node probably has a parent with a scale different from 1.
来源:https://stackoverflow.com/questions/45775887/getting-scnnode-bounding-size-in-meters