Advanced API
Explicit Worlds
Reference and usage: Explicit Worlds.
| API | Contract |
|---|---|
| jolt_world_create(gx, gy, gz) | Creates an explicit world with world-space gravity; handle > 0 on success. |
| jolt_world_step(world, seconds, collision_steps=1) | Advances this world by seconds; caller controls timing. |
| jolt_step(world, seconds) | Convenience wrapper chooses clamp(ceil(seconds*60),1,64) collision steps. |
| jolt_world_destroy(world) | Releases the explicit world; invalidate retained handles in your code. |
// Standalone raw-only example.
if (jolt_init() == 1) {
var world = jolt_world_create(0, 0, -9.81);
if (world > 0) {
if (jolt_world_step(world, 1/60, 1) != 1) {
show_debug_message(jolt_get_last_error_message());
}
if (jolt_world_destroy(world) != 1) {
show_debug_message(jolt_get_last_error_message());
}
} else show_debug_message(jolt_get_last_error_message());
jolt_shutdown();
}