# ents.FindInSphere

- **Ortam:** İstemci, Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/ents.FindInSphere
- **Çeviri tarihi:** 2025-10-31

```lua
table ents.FindInSphere( Vector origin, number radius )
```

## Açıklama

Belirtilen küre içindeki tüm varlıkları alır.

Bu fonksiyon, dahili olarak haritadaki her varlık için Yönlendirilmiş Sınırlayıcı Kutularına (Orientated Bounding Box) dayanarak [util.IsBoxIntersectingSphere](https://gmod.tr/wiki/util.IsBoxIntersectingSphere) fonksiyonunu çağırır.

## Argümanlar

1. [Vector](https://gmod.tr/wiki/Vector) **origin**: Kürenin merkezi.
2. [number](https://gmod.tr/wiki/number) **radius**: Kürenin yarıçapı.

## Döndürülenler

1. sıralı [table](https://gmod.tr/wiki/table)<[Entity](https://gmod.tr/wiki/Entity)>: Bulunan tüm [Entity](https://gmod.tr/wiki/Entity)'lerin bir tablosu.

### Örnek

Kullanma (Use) tuşuna basılı tutulduğunda, oyuncuya bağlı varlıkları yok sayarak FindInSphere fonksiyonunu görselleştirir.

```lua
local entities  = {}
local entities_sv  = {}
local pos = Vector()
local rad = 1000

if ( SERVER ) then util.AddNetworkString( "send_sv_ents" ) end

hook.Add( "Think", "VisualizeFindInSphere", function()
	local ply = Entity( 1 )
	if ( IsValid( ply ) and ply:KeyDown( IN_USE ) ) then
		pos = ply:GetPos()
		entities = ents.FindInSphere( pos, rad )

		local newTab = {}
		for id, ent in pairs( entities ) do
			if ( ent:GetParent() == ply || ent == ply || ent:GetClass() == "gmod_hands" || ent:GetClass() == "viewmodel" ) then
				-- Bu varlığı yoksay
			else
				local entTable = { ent = ent, pos = ent:GetPos(), ang = ent:GetAngles(), mins = ent:OBBMins(), maxs = ent:OBBMaxs(), class = ent:GetClass() }
				-- doğma noktalarının boyutu olmadığı için taklit ediyoruz
				if ( ent:GetClass() == "info_player_start" ) then
					entTable.mins = ply:OBBMins()
					entTable.maxs = ply:OBBMaxs()
				end
				table.insert( newTab, entTable )
			end
		end
		entities = newTab

		if ( SERVER ) then
			net.Start( "send_sv_ents" )
				net.WriteTable( entities )
			net.Broadcast()
		end
	end
end )

net.Receive( "send_sv_ents",function( len, ply )
	entities_sv = net.ReadTable()
end )

local function RenderEnts( enti, clr, isCl )
	for id, tabl in pairs( enti ) do
		local ent = tabl.ent

		local test = "NULL"
		if ( IsValid( ent ) ) then test = ent:EntIndex() end

		debugoverlay.EntityTextAtPosition( tabl.pos, isCl and 1 or 0, (isCl and "CL " or "SV ") .. "Entity " .. test .. " " .. tabl.class, FrameTime() )
		render.DrawWireframeBox( tabl.pos, tabl.ang, tabl.mins, tabl.maxs, clr, true )
	end
end

local mat = Material( "models/wireframe" )
hook.Add( "PostDrawTranslucentRenderables", "VisualizeFindInSphere", function()

	render.SetMaterial( mat )
	render.DrawSphere( pos, rad, 8, 8 )
	render.DrawSphere( pos, -rad, 8, 8 )

	local clr = Color( 255, 128, 0 )
	RenderEnts( entities, clr, true )

	clr = Color( 0, 128, 255 )
	RenderEnts( entities_sv, clr )

end )
```

**Çıktı:**

![image.png](https://gmod.tr/api/uploads/wiki/44bd5fc29ad96dad30af.png)

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/ents.FindInSphere
