Runtime module

ColliderPainterRuntime generates collision while the game runs, for meshes that do not exist in the editor: a Dynamic Mesh built by gameplay, a Procedural Mesh, or a Static Mesh created at runtime. It uses the same CPU solvers as the editor and applies native collision.

Supported targets

TargetRequirements
Dynamic Mesh ComponentNone beyond closable geometry.
Procedural Mesh ComponentUnreal’s optional ProceduralMeshComponent plugin. The section is Settings.MeshSection. Collision is applied with simple-and-complex routing, so a project-wide complex-as-simple default cannot hide the generated hulls.
Static MeshOnly a transient mesh created at runtime, with CPU-readable data, whose outer supplies a game world. Content assets are rejected.

Runtime requests need geometry that can be closed. Whole meshes close simple open holes and split vertices where parts touch at a single point; a closed part that CoACD refuses as “not a 2-manifold” is decomposed by Native Unreal instead, with a warning.

Platforms

The runtime modules have no platform allowlist. The packaged runtime test (cook, package, run: collision cooking, traces, async, cancel, time budget, transient Static Mesh generation) passed on Win64, on Linux x86_64 run in WSL2, and on an Android x64 emulator. Android arm64 and iOS were compiled but not run. See Compatibility for the exact evidence.

The Generate Collision Async node

In Blueprint, search for Generate Collision Async (category Collider Painter > Collision). Inputs are Target (the component or mesh) and Settings (FCPRuntimeSettings). It activates by itself.

PinTypeMeaning
On ProgressExecFires on the game thread at most every 0.1 s while the worker runs. Success is false and Result is empty.
On CompleteExecFires once when generation finishes, fails or is cancelled. Fraction is 1.
SuccessBooleanTrue on On Complete when collision was generated, applied and checked.
ResultFCPCollisionResultThe shapes, Error, Warnings, Notes, Solve Seconds, Backend Used and Cancelled. Error says why a job failed.
FractionFloatProgress from 0 to 1. A coarse stage fraction, not a time estimate.
StageStringWhat the worker is doing; on completion Complete, Failed or Cancelled.

Both exec pins share one delegate signature, FCPRuntimeCollisionEvent(bool bSuccess, const FCPCollisionResult& Result, float Fraction, const FString& Stage), because a Blueprint async node exposes delegate parameters as pins only when all of its delegates match.

Blueprint example

On BeginPlay, this graph generates collision for the actor’s Dynamic Mesh Component with Draft quality, then branches on Is Collision Result Successful and prints the outcome or the error. It is drawn by an embedded viewer: drag to pan, scroll to zoom.

Paste into a Blueprint whose parent class is Dynamic Mesh Actor.
Full screen Download .txt

Use it in your project

  1. Create a Blueprint class with parent class Dynamic Mesh Actor (it has the Dynamic Mesh Component variable the graph reads).
  2. Press Copy Blueprint, open the Blueprint’s Event Graph and paste (Ctrl+V). If the graph already has an Event BeginPlay node, delete one of the two.
  3. Build the mesh (for example with Geometry Script) before the node runs, then compile and play.

The nodes are: Event BeginPlay → Generate Collision Async (Target: Dynamic Mesh Component; Settings: Make CPRuntime Settings with Decomposition from Get Preset (Draft), Time Budget Seconds 5, Mesh Section 0) → On Complete → Branch on Is Collision Result Successful(Result) → True: Print String “collision generated and applied”; False: Break CPCollisionResult → Error → Print String in red.

FCPRuntimeSettings

FieldDefaultMeaning
DecompositionBackend PrimitiveFirst, otherwise as in decomposition settingsSolver and quality. Assigning a whole preset (Get Preset) also selects that preset’s backend.
Time Budget Seconds5.0A cooperative time limit for the solver. 0 means no limit.
Mesh Section0The Procedural Mesh section to read.

PrimitiveFirst fits whole connected solids as boxes, spheres or capsules when they contain every source vertex and pass sampled surface-error checks, then runs CoACD on the solids that are left, under one hull budget and one deadline. If any stage fails, all output is discarded. Explicitly set CoACD, Native or Primitives to use that backend instead. GetRuntimeBackends() lists the backends that are available and runtime-safe; CuACD is editor-only.

Blocking and asynchronous functions

All live in UCPRuntimeCollisionLibrary unless noted.

FunctionBlocksUse
Generate Collision Async (UCPGenerateCollisionAsyncAction)NoBlueprint gameplay. The node activates automatically.
StartCollisionJob(WorldContext, Target, Settings)NoC++ and Python: creates and activates the same job and returns it. A job that cannot start (no target, unsupported target, a backend that is not runtime-safe) is returned already complete, with the reason in its result’s Error.
Generate Collision (Blocking) — GenerateCollision(Target, Settings)YesAny supported target; always returns the FCPCollisionResult. The form to call from Python.
GenerateForDynamicMesh, GenerateForProceduralMesh, GenerateForStaticMeshYesPer-target blocking calls that return bool and fill an out Result.
IsCollisionResultSuccessful(Result)True when the result has shapes, no error and was not cancelled.
GetRuntimeBackends(), GetPreset(Preset)Available runtime-safe backends; the settings of Draft, Balanced, Precise or Turbo.

Blocking functions suit small meshes. Every blocking function reports a failure the same way: Result.Error says why, and one warning naming the function and the reason is logged to LogColliderPainter.

The job object (UCPGenerateCollisionAsyncAction) also has Cancel, Is Complete, Was Successful, Get Progress Fraction, Get Progress Stage and Get Result.

Threading and lifetime

  1. On the game thread, the target’s geometry is copied into a plain snapshot. No UObject reaches a worker.
  2. A worker cleans the snapshot and runs the solver under the cancel token and time budget.
  3. Workers store plain progress and results; a module-owned game-thread ticker reports them. They never queue code to run on the game thread.
  4. On the game thread, the job checks that the target is still alive, applies native collision, checks the cooked Chaos convex data, and only then fires On Complete with Success.
  • Keep a reference to the job while it runs if you need to cancel it (in C++, store it in a UPROPERTY). In a game world the game instance also keeps it alive. The editor ticks the job queue too, so jobs complete in the editor as well as in PIE and packaged games.
  • Cancel is cooperative. On Complete then reports a cancelled result with no shapes; no partial result is applied.
  • Module shutdown removes the ticker, refuses new jobs, cancels and waits for outstanding workers, and drops delegates before releasing job state.

C++ example

C++
#include "CPGenerateCollisionAsyncAction.h"

FCPRuntimeSettings Settings;
Settings.Decomposition.BackendName = TEXT("CoACD");
Settings.TimeBudgetSeconds = 5.0;

UCPGenerateCollisionAsyncAction* Action =
    UCPGenerateCollisionAsyncAction::GenerateCollisionAsync(WorldContext, DynamicMeshComponent, Settings);

// On Progress and On Complete share one signature (FCPRuntimeCollisionEvent):
//   UFUNCTION() void HandleCollision(bool bSuccess, const FCPCollisionResult& Result, float Fraction, const FString& Stage);
Action->OnProgress.AddDynamic(this, &AMyActor::HandleCollision);
Action->OnComplete.AddDynamic(this, &AMyActor::HandleCollision);

// C++ callers call Activate(); Blueprint async nodes activate automatically.
Action->Activate();
// Keep Action in a UPROPERTY if gameplay needs to call Action->Cancel().

Or call UCPRuntimeCollisionLibrary::StartCollisionJob(WorldContext, Target, Settings), which creates and activates the job in one call.

Python example

The async node’s factory is Blueprint-internal, so Python cannot call it or Activate. Start the same job with start_collision_job and poll it from a tick callback, or block with generate_collision. The world context may be None from editor Python.

Python
import unreal

settings = unreal.CPRuntimeSettings()
job = unreal.CPRuntimeCollisionLibrary.start_collision_job(None, dynamic_mesh_component, settings)

def poll(delta):
    if job.is_complete():
        result = job.get_result()
        print("success" if job.was_successful() else result.error, len(result.shapes))
        unreal.unregister_slate_post_tick_callback(handle)

handle = unreal.register_slate_post_tick_callback(poll)

# Or block (small meshes only); the result is returned even when it failed:
result = unreal.CPRuntimeCollisionLibrary.generate_collision(dynamic_mesh_component, settings)

Use generate_collision rather than the generate_for_* functions from Python: UE’s Python binding turns a bool function with out parameters into None when it returns false, which hides the error. You can also bind the job’s on_complete with add_callable.

Tracing generated collision

Generated shapes are simple collision. Set FCollisionQueryParams::bTraceComplex = false in C++ and turn off Trace Complex on Blueprint trace nodes. Per-shape Query Only, No Collision and mass-contribution flags are kept in the cooked body.

Applies to Collider Painter 1.0.0. Report a problem with this page.

Esc

Type to search the documentation.

↑ ↓ moveEnter openEsc close