Engine → Physics → physics_settings.h
physics_settings
| Type | Struct |
| Namespace | conjure::physics |
| Include File Path | engine/include/conjure/physics/physics_settings.h |
| Source File Path | engine/src/physics/physics_settings.cpp |
| API ↗ | Physics, The physics world and queries |
Syntax
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | allow | bool | true | |
| public | collision | u32 | 1 | |
| public | deterministic | bool | true | |
| public | estimate | bool | true | |
| public | gravity | math::vec3 | math:: | |
| public | layers | physics_layer_table | {} | |
| public | maxBarriers | u32 | 8 | |
| public | maxBodies | u32 | 65536 | |
| public | maxBodyPairs | u32 | 65536 | |
| public | max | u32 | 256 | |
| public | max | u32 | 16384 | |
| public | max | u32 | 16384 | |
| public | maxJobs | u32 | 2048 | |
| public | max | u32 | 8192 | |
| public | num | u32 | 0 | |
| public | num | u32 | 2 | |
| public | num | u32 | 10 | |
| public | penetration | f32 | 0.005f | |
| public | point | f32 | 0.03f | |
| public | speculative | f32 | 0.02f | |
| public | temp | usize | 32 * MIB | |
| public | time | f32 | 0.5f |
Functions
Public
from_json
from_json[[nodiscard]] static core::result<physics_settings> from_json(
const core::json::value &physicsSection,
const core::json::value &layersSection);Reads the project.json "physics" object (snake_case keys matching the fields above; "enabled" is the engine's and is ignored; unknown keys log one WARN each) and the "extensions.physics_layers" object (an invalid or missing value keeps the default table). Fails with INVALID_SETTINGS for a value of the wrong type and with the layer errors of physics_layer_table::from_json. The result is not validated; call validate().
validate
validate[[nodiscard]] core::result<void> validate() const;Rejects maxBodies == 0 or above 1 << 23, a maxBodyPairs or maxContactConstraints below 4 or above 1 << 24, collisionSteps == 0, tempAllocatorBytes below 1 MiB, a maxJobs below 64 or not a power of two, maxBarriers == 0, maxContactEventsPerStep == 0, maxQueuedCommands == 0, maxCharacters == 0, numVelocitySteps == 0, numPositionSteps == 0, a negative timeBeforeSleepSeconds, pointVelocitySleepThreshold, speculativeContactDistance or penetrationSlop, a non-finite gravity, and whatever layers.validate() rejects. The INVALID_SETTINGS message names the field.