codeAPI Reference

s&box TriggerPush: Trigger-based push force

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

TriggerPush Component API Reference

TriggerPush is a Component that pushes objects (players and rigidbodies) that enter its trigger collider.

Type Signature

CSHARP
[Category("Gameplay"), Icon("compare_arrows"), EditorHandle(Icon = "🌠")]
public sealed class TriggerPush : Component, Component.ITriggerListener
{
    [Property] Vector3 Direction { get; set; } = Vector3.Up;
    [Property] float Power { get; set; } = 20.0f;
    [Property] List<GameObject> Objects { get; set; }

    void ITriggerListener.OnTriggerEnter(Collider other);
    void ITriggerListener.OnTriggerExit(Collider other);
}

Properties

Event Handlers

OnTriggerEnter(Collider other)

Adds the object to the Objects list if it has a Rigidbody component.

OnTriggerExit(Collider other)

Removes the object from the Objects list.

Behavior

In OnFixedUpdate:

  • Iterates through all objects in the trigger

  • For players: calls Controller.PreventGrounding() to prevent them from sticking to the ground

  • For rigidbodies: adds velocity in the Direction * Power

  • Removes invalid objects from the list

Usage

CSHARP
// Create a jump pad
var trigger = go.AddComponent<TriggerPush>();
trigger.Direction = Vector3.Up * 0.5f + Vector3.Forward * 0.5f;
trigger.Power = 500.0f;

// Add a collider
var collider = go.AddComponent<BoxCollider>();
collider.Size = new Vector3(100, 100, 10);

Notes

  • Implements ITriggerListener to detect objects entering/exiting
  • Uses FindMode.EverythingInSelfAndParent to find rigidbodies
  • Players are prevented from grounding while in the trigger
  • Objects are tracked by their Root GameObject
  • Invalid objects are automatically removed from the list
Was this helpful?