Body State
Activation and Sleeping
Settled Dynamic bodies may sleep to avoid unnecessary simulation work. Sleeping is not destruction: the body remains in the world and can wake again. Disabling sleep for every body is usually unnecessary.
| API | Contract |
|---|---|
| body.activate() / deactivate() | Requests wake/sleep; returns success status. |
| body.is_active() | Reads activation, not handle validity. |
| body.set_allow_sleeping(enabled) / get_allow_sleeping() | Controls whether the native body may sleep; unsupported motion properties can cause failure. |
if (!body.set_allow_sleeping(true)) show_debug_message(jolt_get_error_message());
if (!body.activate()) show_debug_message(jolt_get_error_message());Verified operation contracts#
These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.
| Symbol / owner | Signature | Operation contract |
|---|---|---|
| JoltBody.activate | JoltBody.activate() | Activate/sleep/allow sleeping: setters Boolean success, getters Boolean state (also false on error). Sleep does not destroy the body; disabling sleeping has a performance cost. |
| JoltBody.deactivate | JoltBody.deactivate() | Activate/sleep/allow sleeping: setters Boolean success, getters Boolean state (also false on error). Sleep does not destroy the body; disabling sleeping has a performance cost. |
| JoltBody.get_allow_sleeping | JoltBody.get_allow_sleeping() | Activate/sleep/allow sleeping: setters Boolean success, getters Boolean state (also false on error). Sleep does not destroy the body; disabling sleeping has a performance cost. |
| JoltBody.is_active | JoltBody.is_active() | Activate/sleep/allow sleeping: setters Boolean success, getters Boolean state (also false on error). Sleep does not destroy the body; disabling sleeping has a performance cost. |
| JoltBody.set_allow_sleeping | JoltBody.set_allow_sleeping(allow) | Activate/sleep/allow sleeping: setters Boolean success, getters Boolean state (also false on error). Sleep does not destroy the body; disabling sleeping has a performance cost. |