Skip to content

Investigate using ESimCallbackOptions to make clipping polygons affect physics, too #1737

@kring

Description

@kring

@AlbanBERGERET-Epic made the excellent suggestion that it may be possible to dynamically filter physics collisions and line traces using Chaos ESimCallbackOptions. This may allow us to make clipping polygons clip physics, too, without needing to cut actual geometry.

See Alban's tutorial that shows how to set up hooks into Chaos:
https://dev.epicgames.com/community/learning/tutorials/lydy/unreal-engine-using-chaos-callbacks-for-a-custom-gravity-system-working-with-round-worlds#thekeypoint:addingthecustomasynccallback

And he provided this information about the various ESimCallbackOptions:

None = 0

  • No callbacks enabled.
  • Used as a default or to explicitly disable all simulation callbacks.

Presimulate = 1 << 0

  • Fired before the physics step begins, once per tick.
  • Use case: set up per-step state, update forces or constraints before the solver starts.

MidPhaseModification = 1 << 1

  • Runs after midphase collision detection (broadphase → midphase).
  • Lets you modify or filter pairs before narrowphase contact generation.
  • Useful for disabling collisions between specific shape pairs dynamically.

CCDModification = 1 << 2

  • Called during continuous collision detection (CCD) pass.
  • Lets you modify or filter CCD interactions (e.g., tunneling fixes for fast-moving projectiles).

ContactModification = 1 << 3

  • Runs once contacts are generated but before they are solved.
  • You can edit friction, restitution, contact normals, or cull contacts.
  • Expensive, used sparingly.

StrainModification = 1 << 5

  • Triggered for geometry collections / strain fields in Chaos Destruction.
  • Lets you adjust fracture strain thresholds dynamically before they're applied.

ParticleRegister = 1 << 6

  • Called when a particle (rigid body, etc.) is registered with the solver.
  • Use case: initialize per-particle data structures or gameplay bookkeeping.

ParticleUnregister = 1 << 7

  • Called when a particle is removed/unregistered from the solver.
  • Use case: cleanup any external state tied to that body.

RunOnFrozenGameThread = 1 << 8

  • Special option: forces the callback to be run on the game thread, even when the solver is frozen or detached.
  • Helps ensure deterministic updates or when engine/game thread sync is required.

Rewind = 1 << 9

  • Invoked when rewind is needed for networked physics rollback (Chaos supports a rollback mechanism for net prediction).
  • Use case: restore state to a previous frame for correction.

PhysicsObjectUnregister = 1 << 10

  • Fired when a PhysicsObject wrapper (higher-level than particle) is unregistered.
  • Slightly different from ParticleUnregister: this is about Chaos "physics objects" (proxy entities that wrap particles/constraints).

PreIntegrate = 1 << 11

  • Called right before velocity/position integration.
  • Use case: last chance to apply forces/impulses before integration runs.

PostIntegrate = 1 << 12

  • Called immediately after integration, before constraint solving.
  • Use case: inspect/update particle transforms, velocities after they've been integrated.

PreSolve = 1 << 13

  • Runs just before the solver applies constraints.
  • Good place for last-minute constraint modifications.

PostSolve = 1 << 14

  • Runs after constraint solving is complete, before final state is committed.
  • Use case: inspect impulses, detect high forces, or run gameplay responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    researchExplore an idea or prototype a concept and share the results

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions