0

I'm loading a model from a USDC file.

After loading it in, I update the scale like so:

       modelNode.scale = SCNVector3(
           targetX/(modelNode.boundingBox.max.x - modelNode.boundingBox.min.x),
            targetY/(modelNode.boundingBox.max.y - modelNode.boundingBox.min.y),
            targetZ/(modelNode.boundingBox.max.z - modelNode.boundingBox.min.z)
        )
        

but when I go to check the new bounding box for the node, it still returns the original size bounding box.

From the docs, it seems like SceneKit should calculate this box for me automatically based on the geometry. Do I need to set it myself?

I need to find out the bounding box that the model is taking up in my world.

Andy Hin
  • 30,345
  • 42
  • 99
  • 142
  • where are the target X Y Z values come from? – ZAY Jul 31 '23 at 08:22
  • @ZAY they’re just constants representing the size I want – Andy Hin Jul 31 '23 at 12:49
  • Do you have a scratch project you could share? – ZAY Jul 31 '23 at 13:14
  • @ZAY I'll try to put one together. In the meantime, do you know if the expected behavior is for bounds to update automatically when scale is changed? – Andy Hin Jul 31 '23 at 14:49
  • I never tryed or mesured what's going on with the bounds, when scaling a node. that could be interesting. Also wondering if it behaves the same, when using the scale property or the transform property. – ZAY Aug 01 '23 at 14:08

0 Answers0