# CreatePhysCollideBox

- **Ortam:** İstemci, Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/Global.CreatePhysCollideBox
- **Çeviri tarihi:** 2025-09-08

```lua
PhysCollide CreatePhysCollideBox( Vector mins, Vector maxs )
```

## Açıklama

Verilen sınırlardan yeni bir [PhysCollide](https://gmod.tr/wiki/PhysCollide) oluşturur.

> **HATA:** Bu, düzlemler veya noktalar oluşturamaz - mins veya maxs vektörlerinin hiçbir bileşeni aynı olamaz.
> Sorun Takipçisi: [3568](https://github.com/Facepunch/garrysmod-issues/issues/3568)

## Argümanlar

1. [Vector](https://gmod.tr/wiki/Vector) **mins**: Kutunun minimum köşesi. Bu, maxs ile otomatik olarak sıralanmaz ve en küçük vektör bileşenlerini içermelidir. Bakınız: [OrderVectors](https://gmod.tr/wiki/Global.OrderVectors).
2. [Vector](https://gmod.tr/wiki/Vector) **maxs**: Kutunun maksimum köşesi. Bu, mins ile otomatik olarak sıralanmaz ve en büyük vektör bileşenlerini içermelidir.

## Döndürülen Değer

1. [PhysCollide](https://gmod.tr/wiki/PhysCollide): Yeni PhysCollide. Hatalı vektörler verilirse veya fizik motorunda daha fazla PhysCollide oluşturulamazsa bu, NULL bir PhysCollide olacaktır ([PhysCollide:IsValid](https://gmod.tr/wiki/PhysCollide:IsValid), false döndürür).

### Örnek

VPhysics nesneleri ve oyuncu hareketiyle doğru şekilde etkileşime giren bir kutu.

```lua
AddCSLuaFile()

DEFINE_BASECLASS( "base_anim" )

ENT.PrintName = "Cube"
ENT.Spawnable = true

ENT.Mins = Vector( -16, -16, -16 )
ENT.Maxs = Vector(  16,  16,  16 )

function ENT:Initialize()
    self.PhysCollide = CreatePhysCollideBox( self.Mins, self.Maxs )
    self:SetCollisionBounds( self.Mins, self.Maxs )

    if SERVER then
        self:PhysicsInitBox( self.Mins, self.Maxs )
        self:SetSolid( SOLID_VPHYSICS )
        self:PhysWake()
    end

    if CLIENT then
        self:SetRenderBounds( self.Mins, self.Maxs )
    end

    self:EnableCustomCollisions( true )
    self:DrawShadow( false )
end

-- Işınlara karşı çarpışmaları yönetir. Bu, oyuncu hareketini de içerir.
function ENT:TestCollision( startpos, delta, isbox, extents )
    if not IsValid( self.PhysCollide ) then
        return
    end

    -- TraceBox, ışının kutunun merkezinden başlamasını bekler, ancak TestCollision hatalıdır
    local max = extents
    local min = -extents
    max.z = max.z - min.z
    min.z = 0

    local hit, norm, frac = self.PhysCollide:TraceBox( self:GetPos(), self:GetAngles(), startpos, startpos + delta, min, max )

    if not hit then
        return
    end

    return {
        HitPos = hit,
        Normal  = norm,
        Fraction = frac,
    }
end

function ENT:Draw()
    render.DrawWireframeBox( self:GetPos(), self:GetAngles(), self.Mins, self.Maxs, Color( 255, 0, 0 ), true )
end
```

- [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/Global.CreatePhysCollideBox
