FMeshColliderDefaults
What collider a freshly placed mesh should get. Nothing in the engine used to create one at all: every instantiation site added a MeshRenderer and stopped, so a placed prop either had no collision or — once a human added a Collider and left the enum alone — collided as a half-metre box regardless of what it looked like. UE's contract is the one implemented here: a placed static mesh collides by its mesh's own collision setup, and a mesh with no setup gets a primitive fitted to it rather than a fixed default.
- Module
- Game
- Header
#include "Physics/MeshColliderDefaults.h"- Namespace
Mowo
This decides and writes component fields only. Cooking stays in the Physics image, where Jolt's per-image allocator is armed — nothing here allocates a Jolt shape.
Public functions
| Returns | Name | Description |
|---|---|---|
bool | IsEnabled | r.Physics.AutoCollider, and therefore also the project's cvars.r.Physics.AutoCollider config entry, which a project sets to 0 when its props carry hand-placed collision and an engine-fitted box would be a second, wrong body around every one of them. |
FMeshColliderDecision | DecideFromSetup | The whole decision, with no World, no AssetManager and no renderer — everything it needs is passed in, so it is testable on a CPU-only host. |
FMeshColliderDecision | DecideForPrimitive | A built-in primitive ("cube", "sphere", ...). |
FMeshColliderDecision | DecideForMesh | The same decision for a model path: reads the .mmeshmeta through FMeshCollisionLibrary and measures the mesh through the AssetManager. |
bool | EnsureCollider | The call every instantiation site makes, right after it assigns the MeshRenderer. |
bool | IsUnauthored | True when the collider carries no authorship: either the untouched component default (the half-metre box this whole helper exists to stop shipping) or exactly the fitted box the decision carries. |
void | Apply |
Function details
IsEnabled
static bool IsEnabled()r.Physics.AutoCollider, and therefore also the project's cvars.r.Physics.AutoCollider config entry, which a project sets to 0 when its props carry hand-placed collision and an engine-fitted box would be a second, wrong body around every one of them.
DecideFromSetup
static FMeshColliderDecision DecideFromSetup(const FMeshAssetMeta& setup, bool hasAuthoredSetup, bool hasCollisionPieces, const Vec3& boundsMin, const Vec3& boundsMax, bool hasBounds)The whole decision, with no World, no AssetManager and no renderer — everything it needs is passed in, so it is testable on a CPU-only host.
DecideForPrimitive
static FMeshColliderDecision DecideForPrimitive(const std::string& meshType, const Vec3& boundsMin, const Vec3& boundsMax, bool hasBounds)A built-in primitive ("cube", "sphere", ...). Bounds are used when the entity's mesh is already resident; otherwise the primitive's own known dimensions stand in, because the editor palette assigns the type and leaves hydration to the scene.
DecideForMesh
static FMeshColliderDecision DecideForMesh(const std::string& modelPath, int32_t modelNodeIndex)The same decision for a model path: reads the .mmeshmeta through FMeshCollisionLibrary and measures the mesh through the AssetManager. modelNodeIndex >= 0 means the entity owns ONE node of a hierarchy-instantiated model, which deliberately ignores the sidecar — the authored setup covers the whole model, and handing it to every node would give each one the entire building's collision.
EnsureCollider
static bool EnsureCollider(World* world, EntityID entity)The call every instantiation site makes, right after it assigns the MeshRenderer. Adds the collider the mesh asks for; adds nothing when the entity already carries a collider somebody shaped.
IsUnauthored
static bool IsUnauthored(const ColliderComponent& collider, const FMeshColliderDecision& decision)True when the collider carries no authorship: either the untouched component default (the half-metre box this whole helper exists to stop shipping) or exactly the fitted box the decision carries.
Apply
static void Apply(const FMeshColliderDecision& decision, ColliderComponent& collider)