Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhysicsLoopHook

Shared Openplanet plugin that owns one native physics hook and dispatches registered callbacks.

Consumer plugins should only register and unregister callbacks.

Add a dependency in your plugin:

[script]
dependencies = ["PhysicsLoopHook"]

Then register a callback:

int g_CallbackId = -1;
PhysicsLoopHook::IPhysicsLoopCallback@ g_Callback;

class MyPhysicsLoopCallback : PhysicsLoopHook::IPhysicsLoopCallback {
    void OnPhysicsLoop() {
        // Runs after the race physics step.
    }
}

void Main() {
    @g_Callback = MyPhysicsLoopCallback();
    g_CallbackId = PhysicsLoopHook::RegisterCallback(
        "MyPlugin",
        g_Callback
    );
}

void OnDestroyed() {
    if (g_CallbackId >= 0) {
        PhysicsLoopHook::UnregisterCallback(g_CallbackId);
        g_CallbackId = -1;
    }
    @g_Callback = null;
}

About

Openplanet plugin that owns one native physics hook and dispatches registered callbacks

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages