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.

5
  • where are the target X Y Z values come from? Commented Jul 31, 2023 at 8:22
  • @ZAY they’re just constants representing the size I want Commented Jul 31, 2023 at 12:49
  • Do you have a scratch project you could share? Commented Jul 31, 2023 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? Commented Jul 31, 2023 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. Commented Aug 1, 2023 at 14:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.