|
IVSmoke 1.0
|
#include <IVSmokeCollisionComponent.h>


Public Member Functions | |
| virtual UBodySetup * | GetBodySetup () override |
| void | TryUpdateCollision (const TArray< uint64 > &VoxelBitArray, const FIntVector &GridResolution, float VoxelSize, int32 ActiveVoxelNum, float SyncTime, bool bForce=false) |
| void | ResetCollision () |
| void | DrawDebugVisualization () const |
Public Attributes | |
| bool | bCollisionEnabled = true |
| int32 | MinCollisionUpdateVoxelNum = 50 |
| float | MinCollisionUpdateInterval = 0.25f |
| bool | bDebugEnabled = false |
Protected Member Functions | |
| virtual void | OnCreatePhysicsState () override |
A primitive component that dynamically generates collision geometry based on the voxel grid data.
Unlike standard static meshes, this component constructs a set of box colliders (AggGeom) representing the active voxels. It uses a binary greedy meshing algorithm to merge adjacent voxels into larger boxes to minimize the physics cost.
This component uses the standard Collision category in the Details panel. By default, it is configured for Query-Only interactions:
You can customize these responses in the Collision Presets (set to 'Custom').
MinCollisionUpdateInterval and MinCollisionUpdateVoxelNum to throttle updates. Definition at line 30 of file IVSmokeCollisionComponent.h.
| UIVSmokeCollisionComponent::UIVSmokeCollisionComponent | ( | ) |
Definition at line 21 of file IVSmokeCollisionComponent.cpp.
| void UIVSmokeCollisionComponent::DrawDebugVisualization | ( | ) | const |
Renders wireframe boxes for each generated collision element (FKBoxElem). Useful for visualizing how the greedy meshing algorithm has optimized the voxels.
Definition at line 245 of file IVSmokeCollisionComponent.cpp.
|
overridevirtual |
Definition at line 40 of file IVSmokeCollisionComponent.cpp.
|
overrideprotectedvirtual |
Definition at line 63 of file IVSmokeCollisionComponent.cpp.
| void UIVSmokeCollisionComponent::ResetCollision | ( | ) |
Clears all generated physics geometry and resets the collision state. Called when the simulation is stopped or reset to ensure no "ghost" collision remains.
Definition at line 220 of file IVSmokeCollisionComponent.cpp.
| void UIVSmokeCollisionComponent::TryUpdateCollision | ( | const TArray< uint64 > & | VoxelBitArray, |
| const FIntVector & | GridResolution, | ||
| float | VoxelSize, | ||
| int32 | ActiveVoxelNum, | ||
| float | SyncTime, | ||
| bool | bForce = false |
||
| ) |
Attempts to update the collision geometry based on the current voxel data.
It checks MinCollisionUpdateInterval and MinCollisionUpdateVoxelNum to throttle updates and prevent performance spikes from frequent physics rebuilding.
| VoxelBitArray | A bitmask buffer where each uint64 element represents a row of voxels along the X-axis. |
| GridResolution | The resolution of the voxel grid (Width, Depth, Height). |
| VoxelSize | World space size of a single voxel. |
| ActiveVoxelNum | Current count of active voxels (used for threshold checks). |
| SyncTime | Current synchronized world time (used for interval checks). |
| bForce | If true, bypasses optimization checks and forces an immediate rebuild. |
Definition at line 70 of file IVSmokeCollisionComponent.cpp.
| bool UIVSmokeCollisionComponent::bCollisionEnabled = true |
Master switch for voxel collision. If false, no physics geometry will be generated, and all update requests will be ignored.
Definition at line 74 of file IVSmokeCollisionComponent.h.
| bool UIVSmokeCollisionComponent::bDebugEnabled = false |
If true, draws debug visualization for the collision geometry in the editor.
IVSmokeDebugSettings::bDebugEnabled is also true on the main actor. Definition at line 122 of file IVSmokeCollisionComponent.h.
| float UIVSmokeCollisionComponent::MinCollisionUpdateInterval = 0.25f |
The minimum time (in seconds) that must pass between two consecutive physics geometry rebuilds.
Definition at line 82 of file IVSmokeCollisionComponent.h.
| int32 UIVSmokeCollisionComponent::MinCollisionUpdateVoxelNum = 50 |
The minimum number of voxel changes (spawned or destroyed) required to trigger a physics geometry rebuild.
Definition at line 78 of file IVSmokeCollisionComponent.h.