Entity.BoundingRadius

From GMod Wiki

Jump to: navigation, search
Function
Syntax Entity:BoundingRadius( )
Description:
Returns the distance between the center of the bounding box and the furthest bounding box corner. See image for example.
Returns: Float
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.BoundingRadius]Entity.BoundingRadius [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

Descriptionlua_run LocalPlayer():PrintMessage( HUD_PRINTTALK, "Radius: "..Entity.BoundingRadius())
Used onNewerShared.png
Code
function Brad( player )
	local tr = utilx.GetPlayerTrace( player, player:GetCursorAimVector() )
	local trace = util.TraceLine( tr )
	if (!trace.Hit) then return end
	if (!trace.HitNonWorld) then return end
	if (!trace.Entity:IsValid()) then return end
	local ent = trace.Entity
	local rad = ent:BoundingRadius()
	player:PrintMessage( HUD_PRINTTALK, "Prop: " .. ent .. " | Bounding Radius: " .. rad )
end
 
concommand.Add("GetRadius", Brad)
OutputPrint the radius of the prop your looking at to the chat area when you type GetRadius into your console


Additional Notes

Bounding Sphere, bounding box, and bounding radius.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox