cant get x,y,z co-ords of child

Blitz3D Forums/Blitz3D Programming/cant get x,y,z co-ords of child

You could try this function. It might not work in all circumstances, but maybe you can tweak it a bit:
Function ReplacePos(mesh)

	If EntityClass(mesh) = "Mesh" Then
		minx# = 10000
		miny# = 10000
		minz# = 10000
		maxx# = -10000
		maxy# = -10000
		maxz# = -10000
		For i = 1 To CountSurfaces(mesh)
			surf = GetSurface(mesh, i)
			For j = 0 To CountVertices(surf) - 1
				x# = VertexX(surf, j)
				y# = VertexY(surf, j)
				z# = VertexZ(surf, j)
				If x < minx Then minx = x
				If x > maxx Then maxx = x
				If y < miny Then minx = y
				If y > maxy Then maxx = y
				If z < minz Then minx = z
				If z > maxz Then maxx = z
			Next
		Next
		midx# = (minx + maxx) / 2
		midy# = (miny + maxy) / 2
		midz# = (minz + maxz) / 2
		PositionMesh mesh, -midx, -midy, -midz
		PositionEntity mesh, midx, midy, midz
	End If

	For i = 1 To CountChildren(mesh)
		ReplacePos(GetChild(mesh, i))
	Next
	
End Function