find center point

Blitz3D Forums/Blitz3D Programming/find center point

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

No, there is no function to do that, but you can write one easily.

Loop through all surfaces in the mesh. Loop through all vertices in each surface. Count the vertcies, and add their X Y and Z's together in three seperate variables. Then at the end divide the resulting X Y and Z values by the number of vertices. There's your center.

You can then loop through all the vertices again, get their position and then subtract the location of the center from their location. The result will be a mesh with it's center in the proper location... 0,0,0.