Finding entity's radius

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

kfprimm(Posted 2005) [#1]
how do u find an entity's x/y radius?


Stevie G(Posted 2005) [#2]
Eh.. assuming you haven't scaled it using entityscale then you could simply use MeshWidth()/2.0 and MeshHeight()/2.0. Otherwise you may have to store the details in variables.


John J.(Posted 2005) [#3]
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