Skip to content

Engine → Physics

components.h

The body components. Plain reflected structs with camelCase fields named "conjure.physics.<struct name>"; registered by physics::register_components (register.h). Jolt ids live only inside physics_world, so components copy into prefabs, archives and world_hash without Jolt knowledge. Fields marked [runtime] are read-only in the inspector but serialised (a saved scene reopens with its velocities); the C# mirrors of restate these field lists byte for byte.

Structs

File Description
box_collider Axis-aligned box in entity space. "conjure.physics.box_collider".
capsule_collider Capsule along the entity's Y axis; total height 2 * (halfHeight + radius). "conjure.physics.capsule_collider".
collider_body_plan What the physics world builds of an entity's colliders, as its shape builder decides it: which colliders become part of the body; whether the body waits for a collision mesh to load (then nothing is built); whether it is a trigger (every collider is one); and whether the entity's scale applies to it (true for a unit scale; false where a collider cannot carry the scale, so the body is built unscaled).
collider_set The colliders of one entity, null for a kind it has none of (an entity holds one of each at most).
convex_collider Convex hull of a collision mesh asset. "conjure.physics.convex_collider".
mesh_collider Triangle mesh of a collision mesh asset; STATIC and KINEMATIC bodies only. "conjure.physics.mesh_collider".
physics_material Optional surface properties; combined as sqrt(f1 * f2) and max(r1, r2). "conjure.physics.physics_material".
rigid_body A rigid body. "conjure.physics.rigid_body", 52 bytes, 4-aligned; mirrored by C# RigidBodyData.
sphere_collider Sphere in entity space. "conjure.physics.sphere_collider".

Enumerations

motion_type

enum class motion_type : u8 {
    STATIC,
    KINEMATIC,
    DYNAMIC
};

How a body moves. STATIC never moves, KINEMATIC follows its transform or velocity and pushes dynamic bodies, DYNAMIC is simulated.

rigid_body_flags

enum class rigid_body_flags : u16 {
    NONE = 0,
    CONTINUOUS_COLLISION = 1 << 0,            // EMotionQuality::LinearCast
    KINEMATIC_MOVES_WITH_TRANSFORM = 1 << 1,  // kinematic follows local_transform; else velocity driven
    ALLOW_SLEEPING = 1 << 2,
    START_ASLEEP = 1 << 3,                    // created deactivated
    LOCK_ROTATION = 1 << 4,                   // translation only
    LOCK_ROTATION_X = 1 << 5,
    LOCK_ROTATION_Y = 1 << 6,
    LOCK_ROTATION_Z = 1 << 7,
    LOCK_TRANSLATION_X = 1 << 8,
    LOCK_TRANSLATION_Y = 1 << 9,
    LOCK_TRANSLATION_Z = 1 << 10,
    USE_GYROSCOPIC_FORCE = 1 << 11
};

Per-body switches.

Forward Declarations

collision_mesh_asset

class collision_mesh_asset;

Macros

CONJURE_COMPONENT

CONJURE_COMPONENT(conjure::physics::rigid_body, "conjure.physics.rigid_body")

CONJURE_ENUM_FLAGS

CONJURE_ENUM_FLAGS(rigid_body_flags)

CONJURE_REFLECT_ENUM

CONJURE_REFLECT_ENUM(conjure::physics::motion_type, "conjure.physics.motion_type", STATIC, KINEMATIC, DYNAMIC)

CONJURE_REFLECT_FLAGS

CONJURE_REFLECT_FLAGS(conjure::physics::rigid_body_flags, "conjure.physics.rigid_body_flags", NONE, CONTINUOUS_COLLISION, KINEMATIC_MOVES_WITH_TRANSFORM, ALLOW_SLEEPING, START_ASLEEP, LOCK_ROTATION, LOCK_ROTATION_X, LOCK_ROTATION_Y, LOCK_ROTATION_Z, LOCK_TRANSLATION_X, LOCK_TRANSLATION_Y, LOCK_TRANSLATION_Z, USE_GYROSCOPIC_FORCE)

CONJURE_REFLECT_STRUCT

CONJURE_REFLECT_STRUCT(conjure::physics::rigid_body, "conjure.physics.rigid_body", CONJURE_FIELD(motionType), CONJURE_FIELD(layer, .min = 0.0, .max = 31.0), CONJURE_FIELD(flags), CONJURE_FIELD(mass, .min = 0.0), CONJURE_FIELD(linearDamping, .min = 0.0), CONJURE_FIELD(angularDamping, .min = 0.0), CONJURE_FIELD(gravityFactor), CONJURE_FIELD(maxLinearVelocity, .min = 0.0), CONJURE_FIELD(linearVelocity, .readOnly = true), CONJURE_FIELD(angularVelocity, .readOnly = true), CONJURE_FIELD(isSleeping, .readOnly = true))

Functions

Public

plan_collider_body

[[nodiscard]] CONJURE_API collider_body_plan plan_collider_body(
    const collider_set &colliders,
    motion_type motion,
    const math::vec3 &scale) noexcept;

What the physics world builds of colliders on a body of motion (a rigid_body's motionType, STATIC without one) at the entity's world scale, decided without building anything, so an editor draws the body the world collides with. A convex or mesh collider without a mesh is left out, and so is a mesh collider on a DYNAMIC body; one whose collision mesh is not loaded makes the body pending. With mixed trigger flags the body is no trigger. A scale applies when every kept collider can carry it as Jolt's shapes take one: never a zero component, a sphere or capsule only uniformly, and a collider turned within the body only by a scale its turn keeps axis-aligned. A convex collider whose points make no hull is left out by the world but kept here (the plan builds no hull). An entity with a character_controller has no body of its colliders at all (character_capsule_of).