Center Point in Entity
Blitz3D Forums/Blitz3D Beginners Area/Center Point in Entity
| ||
How would you control an entity from its center point? Kind of like AutoMidHandle except for entities(3d). |
| ||
This function will center your mesh assuming it has a depth, height and width of > 0Function MESHmidhandle( mesh ) Mw# = meshwidth( mesh ) Mh# = meshheight( mesh ) Md# = meshdepth( mesh ) fitmesh mesh, -.5*mw, -.5*mh, -.5*md, mw,mh,md End Function |
| ||
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. |