Finding entity's radius

Blitz3D Forums/Blitz3D Beginners Area/Finding entity's radius

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.

Try using this function:
;Method can be 1, 2, or 3. Experiment on which works best
Function MeshRadius#(mesh, method = 1)
	w# = MeshWidth(mesh) / 2
	h# = MeshHeight(mesh) / 2
	d# = MeshDepth(mesh) / 2
	If method = 1 Then rad# = (w+h+d)/3.0
	If method = 2 Then
		rad# = w
		If h > rad Then rad = h
		If d > rad Then rad = d
	End If
	If method = 3 Then rad# = Sqr(w*w + h*h + d*d)
	Return rad#
End Function