Errors and Diagnostics

Resource Ownership

Keep one clear owner for each resource. A visual instance may own a body, while a persistent controller owns the world. Resources referenced by a vehicle, constraint or helper must not be destroyed behind that object's owner.

APIContract
Managed worldOwns simulation lifetime; jolt_stop() tears down managed resources and runtime.
JoltShape / cache / bodiesSeparate native references can share the same immutable geometry.
GameMaker instance / user_dataRemain caller-owned; assigning them to a body does not transfer their lifetime.
Raw explicit worldCaller must manage dependencies and avoid shutting down shared runtime too early.
GML
// Instance Cleanup event; physics resources are released explicitly.
if (!is_undefined(body)) {
    body.destroy();
    body = undefined;
}