Bounding box of animated mesh

I want to export the bounding box of a mesh that is animated by an armature, and that means the bounding box changes each frame. But object.getBoundBox() always returns the same 8 corners, for every frame. Am I doing something wrong? Or does it return the boundingbox of the undeformed mesh?

  for i in range(startframe, endframe):
    scene.currentFrame(i)
    scene.makeCurrent()
    bbox = object.getBoundBox()
    print bbox

you will need to create your bounding box from the deformed mesh, which is avaliable with python.

though, I forget the code at the moment

You mean NMesh.GetRawFromObject, and then search for the min/max coordinates myself? Hmm, that will be a big performance hit. But looks like it can´t be helped…

Just try this:

###################
import Blender
from Blender import Scene, Object

Sc = Scene.GetCurrent()
startframe =Sc.startFrame()
endframe = Sc.endFrame()

for i in range(startframe, endframe):
    Sc.currentFrame(i)
    Sc.makeCurrent()

    object = Object.GetSelected()[0]
    object.makeDisplayList()

    bbox = object.getBoundBox()
    print "Frame ",i,bbox

###################

Enjoy it ! :wink:

Ph

Thanks for the reply, Ph! But are you sure it works? I still get the same, non-dynamic boundingbox values.

Work well for me . %|

If you want, you can download this .blend to verify .

http://hp.home.chez.tiscali.fr//ph_BBOX.blend

(if troubles to download, push right mouse and do “save as…”)

Ph :Z

Thanks Ph, ofcourse you´re right, it works! :smiley:
I tried it only on Blender2.28 until a few minutes ago when I thought “that can´t be, he obviously is sure that it works”. And it does work on 2.32. Thanks alot for your help!