Center Point in Entity

Blitz3D Forums/Blitz3D Beginners Area/Center Point in Entity

BLaBZ(Posted 2007) [#1]
How would you control an entity from its center point?
Kind of like AutoMidHandle except for entities(3d).


Stevie G(Posted 2007) [#2]
This function will center your mesh assuming it has a depth, height and width of > 0


Function MESHmidhandle( mesh )

  Mw# = meshwidth( mesh )
  Mh# = meshheight( mesh )
  Md# = meshdepth( mesh )
  fitmesh mesh, -.5*mw, -.5*mh, -.5*md, mw,mh,md

End Function



D4NM4N(Posted 2007) [#3]
If its animated though you cant use meshwidth on it but could try this:

http://www.blitzbasic.com/codearcs/codearcs.php?code=1430

It loads an animmesh and scales it using blitz units.

tharefore if you make it 4,4,4 you know the center is
x+2,y+2,z+2

create a pivot at this point and parent the mesh to it and voila! a centrally referenced mesh.