re-center a mesh

BlitzMax Forums/MiniB3D Module/re-center a mesh

ima747(Posted 2009) [#1]
I've got a mesh I'm loading from a file, but the mesh data isn't centered properly, can anyone recommend a way to re-center the mesh?


b32(Posted 2009) [#2]
If the mesh is loaded with LoadMesh, you can use:
w#=meshwidth(mesh)
h#=meshheight(mesh)
d#=meshdepth(mesh)
FitMesh mesh,-w/2.0,-h/2.0,d/2.0,w,h,d

If the object is loaded with LoadAnimMesh, things are more complicated, because it can consist of more than one mesh.


ima747(Posted 2009) [#3]
FITMESH! I knew I saw it somewhere before, thank you thank you!