Skip to content

Engine → Physics

contact_events.h

Contact events. physics_world::contact_events() returns the events of the last step sorted by ascending (bodyIdA, bodyIdB), then kind: per pair per step at most one ENTER / STAY (or TRIGGER_ENTER) and at most one EXIT (or TRIGGER_EXIT), the exit after the enter. Consumers reporting to b flip the normal. Destroying a body in contact synthesises its EXIT / TRIGGER_EXIT, reported by the next step and naming the body's entity. When the body went because that entity was destroyed, the entity is no longer alive: check world::is_alive before touching a participant. The entity's generation keeps the dead id from matching a reused slot, so no later event references it.

Structs

File Description
contact_event One contact event. 48 bytes, trivially copyable.

Enumerations

contact_kind

enum class contact_kind : u8 {
    ENTER,
    STAY,
    EXIT,
    TRIGGER_ENTER,
    TRIGGER_EXIT
};

What happened to a body pair in the step. Trigger pairs report only the TRIGGER_ kinds.

Functions

Public

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    contact_kind kind) noexcept;

The upper-case enumerator name of a kind ("ENTER"); "UNKNOWN" for out-of-range values.