terminalCode Example

SpawnPoint and TriggerHurt — spawn locations and damage trigger volumes

calendar_today May 5, 2026 schedule ~1 min read person patrickjr verified 50

SpawnPoint and TriggerHurt in s&box

SpawnPoint

SpawnPoint is a built-in s&box component that marks a world location for player or NPC spawning. GameManager uses Scene.GetAll<SpawnPoint>() to find valid spawn locations.
CSHARP
// Find a random spawn point
var spawnPoints = Scene.GetAll<SpawnPoint>().ToList();
if ( spawnPoints.Count > 0 )
{
    var spawn = Game.Random.FromList( spawnPoints );
    player.WorldPosition = spawn.WorldPosition;
    player.WorldRotation = spawn.WorldRotation;
}

TriggerHurt

TriggerHurt damages any IDamageable that enters its trigger collider. Pair it with any Collider component set to IsTrigger = true.
CSHARP
var go = Scene.CreateObject();
go.Name = "Lava Zone";

var collider = go.Components.Create<BoxCollider>();
collider.Size      = new Vector3( 500, 500, 50 );
collider.IsTrigger = true;

var hurt = go.Components.Create<TriggerHurt>();
hurt.Damage = 25f;   // damage per tick
hurt.Rate   = 0.5f;  // seconds between ticks

FireDamage

FireDamage applies continuous fire-tagged DamageInfo per second — useful for burning effects on props and players:
CSHARP
var fire = go.Components.Create<FireDamage>();
fire.DamagePerSecond = 10f;

Receiving Damage

Both TriggerHurt and FireDamage call IDamageable.OnDamage on components in the trigger:

CSHARP
public sealed class PlayerHealth : Component, IDamageable
{
    public float Health { get; set; } = 100f;

    public void OnDamage( in DamageInfo info )
    {
        Health -= info.Damage;
        if ( Health <= 0f ) Die();
    }
}
Was this helpful?