DestructionSystem
- Module
- Destruction
- Header
#include "Destruction/DestructionSystem.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
DestructionSystem() = default | DestructionSystem | |
~DestructionSystem() override = default | ~DestructionSystem | |
DestructionSystem(const DestructionSystem&) = delete | DestructionSystem |
Public functions
| Returns | Name | Description |
|---|---|---|
DestructionSystem& | operator= | |
void | Initialize | |
void | Shutdown | |
void | Update | |
void | SetSceneHooks | Scene injects these so runtime-spawned pieces are registered with the Scene's entity metadata (name, layers, render filter). |
void | ApplyDamageField | Field-based damage: every Destructible whose position lies within radius of center breaks, and its debris inherits an extra velocity pointing away from the center, scaled by impulse and a linear distance falloff — the explosion primitive (grenades, barrels, spells). |
bool | BreakWithEvent | Breaks entity from an explicit event — the client replay path, and the way a test pins that two peers land the same shards. |
uint32_t | ApplyPointDamage | Partial damage at a world point. |
bool | IsRemnantPiece | Remnant bookkeeping, for tests and tools: how many pieces of the prop that entity belonged to are still standing, and whether an entity is a standing remnant piece at all. |
uint32_t | StandingPieceCount | |
FDestructionBreakEvent | MakeBreakEvent | The event the host would send for a break of entity now. |
Vec3 | PieceLaunchVelocity | Pure over its inputs: the same event lands the same shard the same way on every peer, and a different seed lands it differently. |
const FFractureBakeData* | ResolveBake | Cached per path; a miss stays cached as null so a broken reference is reported once rather than re-read on every break. |
void | RegisterBake | Seeds the cache directly — a headless test has no VFS to load from, and a game that ships bakes inside its own archive can hand them over. |
FDebrisPool& | GetDebrisPool |
Function details
DestructionSystem
DestructionSystem() = default~DestructionSystem
~DestructionSystem() override = defaultDestructionSystem
DestructionSystem(const DestructionSystem&) = deleteoperator=
DestructionSystem& operator=(const DestructionSystem&) = deleteInitialize
void Initialize(World* world) overrideShutdown
void Shutdown() overrideUpdate
void Update(float deltaTime) overrideSetSceneHooks
void SetSceneHooks(std::function<EntityID(const std::string&)> createEntity, std::function<void(EntityID)> destroyEntity)Scene injects these so runtime-spawned pieces are registered with the Scene's entity metadata (name, layers, render filter). Without hooks the system falls back to raw World entities (headless tests).
ApplyDamageField
void ApplyDamageField(const Vec3& center, float radius, float impulse)Field-based damage: every Destructible whose position lies within radius of center breaks, and its debris inherits an extra velocity pointing away from the center, scaled by impulse and a linear distance falloff — the explosion primitive (grenades, barrels, spells). Enabled/broken state and cascades behave as in impact breaks.
BreakWithEvent
bool BreakWithEvent(EntityID entity, const FDestructionBreakEvent& event)Breaks entity from an explicit event — the client replay path, and the way a test pins that two peers land the same shards.
ApplyPointDamage
uint32_t ApplyPointDamage(EntityID entity, const Vec3& point, float radius, float impulse, bool fromNetwork = false)Partial damage at a world point. entity is a Destructible with Partial Damage on, or a remnant piece of one already hit. The pieces within radius of the point are released as debris (pushed away from the point by impulse), then everything left that cannot reach an anchored piece through shared faces is released too. Returns the number of pieces released; 0 when nothing was in range or the entity is not damageable this way. The whole-prop break is what a Destructible without Partial Damage does instead.
IsRemnantPiece
bool IsRemnantPiece(EntityID entity) constRemnant bookkeeping, for tests and tools: how many pieces of the prop that entity belonged to are still standing, and whether an entity is a standing remnant piece at all.
StandingPieceCount
uint32_t StandingPieceCount(EntityID entity) constMakeBreakEvent
FDestructionBreakEvent MakeBreakEvent(EntityID entity, const DestructibleComponent& dc)The event the host would send for a break of entity now.
PieceLaunchVelocity
static Vec3 PieceLaunchVelocity(const FFracturePiece& piece, uint32_t pieceIndex, const Vec3& inheritedVelocity, float scatter, uint32_t seed)Pure over its inputs: the same event lands the same shard the same way on every peer, and a different seed lands it differently.
ResolveBake
const FFractureBakeData* ResolveBake(const std::string& path)Cached per path; a miss stays cached as null so a broken reference is reported once rather than re-read on every break.
RegisterBake
void RegisterBake(const std::string& path, const FFractureBakeData& data)Seeds the cache directly — a headless test has no VFS to load from, and a game that ships bakes inside its own archive can hand them over.
GetDebrisPool
FDebrisPool& GetDebrisPool()