ball = loader.loadModel(“smiley”)
ball.reparentTo(render)
ball.showBounds()
print ball.getBounds()
bsphere, c (0,0,0), r 1.73205
The above snippet shows that the bounding box for the smiley is actually a sphere larger than the visible geometry, which is a sphere of radius 1. The bounding radius is √3, which means the bounds are a sphere circumscribing a cube circumscribing the actual sphere.
ball.showTightBounds()
The “tighter” bounds are in fact that cube.
A few questions:
Why does getBounds()] return an incorrect bsphere? Best case would be a bsphere of radius 1, which would be perfect. Second best would be to the circumscribing bbox. if the exact bsphere calculation is too intensive to do automatically. But … returning a bsphere circumscribing a bbox circumscribing the correct sphere??
Why does showTightBounds() not show the correct bsphere? The bbox is better than getBounds, but still not very tight. I would have expected Bounds to be the bbox and TightBounds the bpshere.
Even if TightBounds were good enough, how do I get the actual bounds? I would expect calcTightBounds() to update the NodePath with TightBounds. It doesn’t. I really don’t know what the hell it does that’s useful.
If panda3d cannot in any way get the correct bounds by itself, how do I manually do it?
I cannot setBounds() on the NodePath ball, nor does
ball.node().setBounds(BoundingSphere(Point3(0,0,0), 1))
correct the bounds of ball.
Thanks to ThomasEgi on IRC for trying to make sense of all this, BTW.