menu_bookDocumentation

IScenePhysicsEvents: Pre and Post Physics Step Hooks

calendar_today May 20, 2026 schedule ~1 min read person PatrickJr verified 50
IScenePhysicsEvents lets Components or GameObjectSystems wrap logic around the physics step. Implement it when you have systems that work closely with physics and need to run code immediately before or after the physics simulation.

Interface Definition

CSHARP
public interface IScenePhysicsEvents : ISceneEvent<IScenePhysicsEvents>
{
    void PrePhysicsStep() { }
    void PostPhysicsStep() { }
}

Usage

Implement on any Component:

CSHARP
public sealed class PhysicsDebugger : Component, IScenePhysicsEvents
{
    void IScenePhysicsEvents.PrePhysicsStep()
    {
        // Called right after FixedUpdate, before physics simulation runs
        // Good for: applying forces, setting velocities, preparing constraints
    }

    void IScenePhysicsEvents.PostPhysicsStep()
    {
        // Called after physics simulation completes
        // Good for: reading final positions, checking contacts, applying corrections
    }
}

Timing

This is useful for custom physics interactions, vehicle systems, ragdoll controllers, or any logic that needs to read physics results before the next frame renders.
Was this helpful?