Skip to main content

b2World_Restore

Function b2World_Restore 

Source
pub unsafe extern "C" fn b2World_Restore(
    worldId: b2WorldId,
    image: *const u8,
    size: c_int,
) -> bool
Expand description

Restore a world’s simulation state from a snapshot image, in place. The world keeps its slot and generation, so this b2WorldId and any ids held from this same world stay valid for objects that existed at the snapshot instant. Host wiring is preserved. Restore into the same world the snapshot came from to keep held ids valid. Must be called at a step boundary. @param worldId The world to restore into @param image A snapshot image produced by b2World_Snapshot @param size Size of image in bytes @return true on success. On a rejected image (bad magic, version, or layout) the world is left unchanged. A corrupt payload detected after the rebuild begins returns false and leaves the world unusable, so the caller must destroy it.