Bounding box for a NodePath

Is there a way to get the length, width and height of a NodePath suitable to build a bounding box? getBounds() returns data suitable for a CollisionSphere (centerpoint and radius).

I am trying to build and display the tightest rectangular volume that will enclose the NodePath and it’s children.

thanx in advance



# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Description:
#	Retrieve the dimensions of a NodePath instance.
# Input(s):
#	nPath - NodePath to be examined.
# Output(s):
#	Returns a tuple with 3 elements as follows:
#		out[0] - Model X dimension
#		out[1] - Model Y dimension
#		out[2] - Model Z dimension
def GetDimensions(nPath) :
	pt1, pt2 = nPath.getTightBounds()
	xDim = pt2.getX() - pt1.getX()
	yDim = pt2.getY() - pt1.getY()
	zDim = pt2.getZ() - pt1.getZ()
	return [xDim,yDim,zDim]

Man that was a fast reply! You guys rock.

The more I play with Panda the more impressed I get.

This is quicker and functionally equivalent:

def GetDimensions(nPath):
  pt1, pt2 = nodePath.getTightBounds()
  return pt2 - pt1