Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

REFERENCECOMPONENTS

UCFGlassUnitsComponent

MODULECrushformINCLUDECFGlassUnitsComponent.hPARENTUCFBreakableUnitsComponent

The glass of one Crushform body: every UCFGlassComponent of the owner is a unit of two levels (cracked, broken), numbered by name so that all machines agree. The cracks replicate beside the levels; the machine that draws writes them into each pane's Custom Primitive Data, shows a pane broken by hiding it, and plays the crack and break feedback.

Functions

AUTHORITY · server, every machineLOCAL · this machinePURE · read only
bool ShouldDrawInNetMode(ENetMode NetMode)
C++ ONLY

Whether this machine draws the glass: the cracks, the pieces and the sound. False on a dedicated server.

void InitPanes(UCFDeformComponent& InDeform)
C++ ONLY

BeginPlay of InDeform: numbers the owner's panes by name, maps followers and door parts, reads their boxes, writes their data.

bool HasPanes() const
PUREC++ ONLY

Whether the owner has any pane.

void ResetForGeneration(uint8 InGeneration)
C++ ONLY

Any machine: a newer Crushform generation puts every pane back whole and drops every crack of the old one.

bool ApplyVerdictOnAuthority(int32 UnitIndex, const FCFGlassVerdict& Verdict, uint16 SourceSeq, uint8 ResponseIndex = CFBreakable::NoResponse)
AUTHORITYC++ ONLY

Authority: raises the pane by the verdict and records its crack. True if the pane's level or cracks changed.

bool PredictVerdict(int32 UnitIndex, const FCFGlassVerdict& Verdict, uint16 Seq, uint8 ResponseIndex = CFBreakable::NoResponse)
C++ ONLY

Impact source: shows the verdict now and waits for the authority; Seq is the report that carries it. True if anything changed.

void OnReportsRejected(TConstArrayView<uint16> Seqs)
C++ ONLY

The authority refused these reports: every pane they predicted goes back now.

void JudgeOnAuthority(const FCFLattice& Lattice, const FCFHitInput* Hit, uint32 ReachedChunks, uint16 SourceSeq, bool bLatticeChanged)
C++ ONLY

Authority, after a hit was applied to the lattice (Hit null: a crush with no contact point, the frame alone). ReachedChunks: bit c for each chunk the hit reached (CFGlass::ToChunkMask). SourceSeq: the report being judged now, 0 for the authority's own hit. bLatticeChanged: the hit moved the lattice; the frame is judged only then, so an old dent is never judged again.

bool JudgePredicted(const FCFLattice& Lattice, const FCFHitInput& Hit, uint32 ReachedChunks, uint16 Seq, bool bLatticeChanged)
C++ ONLY

Impact source, on the decoded report and the lattice as drawn with it. True when any pane changes: the report must go.

UCFGlassComponent* GetPane(int32 UnitIndex) const
PURE

The pane component of a unit; null for an index with no pane.

Category
Crushform|Glass
int32 FindPane(const UPrimitiveComponent* Primitive) const
PUREC++ ONLY

The pane Primitive is, or the follower it is; INDEX_NONE otherwise.

const CFGlass::FPaneShape* GetPaneShape(int32 UnitIndex) const
PUREC++ ONLY

Where the pane lies, for judging a hit; null for an index with no pane.

int32 GetPanePart(int32 UnitIndex) const
PUREC++ ONLY

Hinge index of the part the pane hangs under, INDEX_NONE on the body.

bool IsPaneJudged(int32 UnitIndex) const
PUREC++ ONLY

Whether Crushform may judge the pane: it has a definition and a valid shape, and its part is not off (UCFDeformComponent::IsPartOffOrReportedOff).

FTransform GetPaneWorldTransform(int32 UnitIndex) const
PUREC++ ONLY

Where the pane is now: the body's read pose, or its part's (UCFHingeComponent::GetPartReadPose).

TArray<FCFGlassCrack, TInlineAllocator<CFGlass::MaxCracksPerPane>> GetDrawnCracks(int32 UnitIndex) const
PUREC++ ONLY

The cracks this machine draws on the pane: the authority's of this generation, each replaced by its own prediction within 1 cm of it (a predicted growth, never smaller than the authority's crack), then its other predictions; at most MaxCracksPerPane.

bool BuildShardSpawn(int32 UnitIndex, const UCFGlassDefinition& Definition, const FCFBreakImpact& WorldImpact, uint32 Seed, float Scale, FCFGlassShardSpawn& OutSpawn) const
PUREC++ ONLY

The shards a broken pane throws, as the shard system takes them: tiles of the definition's pieces laid on the pane's plane nearest the impact, each piece at its pose on its tile and thrown the way the debris pool throws it, from the pane as drawn. Scale is the share of the shards kept, from 0 to 1, taken from the first ones. Returns false, with no shards in OutSpawn, when there is nothing to throw.

void OnShardsHit(int32 UnitIndex, TConstArrayView<FBasicParticleData> Data, const FVector& SimulationPositionOffset)
C++ ONLY

Plays a shard system's impact on this pane, from the particle data the system exports: the fastest shard's speed sets the strength, and the pane sounds at most once per UCFBreakableSettings::DebrisImpactCooldownSeconds. A pane that is not broken plays nothing.

Functions

  • FindUnitsForPrimitiveThe units component Primitive stands for a unit of, and that unit's index: through ICFBreakableUnitPart on the primitive, else the first attach parent that knows the primitive. nullptr when none does.
  • ApplyHitResultOnAuthorityAuthority: applies an outside hit on a primitive to the unit it belongs to.
  • PredictHitResultAny machine: the prediction twin of ApplyHitResultOnAuthority.
  • ApplyHitOnAuthorityAuthority: raises the unit to the level its definition gives this hit (HitResponses), replicates it and plays it.
  • PredictHitAny machine: shows the hit's level now and waits for the authority; undone after PredictionConfirmTimeoutSeconds.
  • GetUnitCountHow many units the owner laid out.
  • GetMaxLevelThe highest level a unit can reach, as given to InitUnits; a unit is intact at 0.
  • GetUnitLevelThe level this machine shows: the authority's, or a prediction ahead of it.
  • GetConfirmedUnitLevelThe level the authority confirmed in the current generation.
  • IsUnitIntactTrue for a valid index whose shown level is 0; false for an invalid index.
  • PredictUnitLevelShows StoredImpact's level now, ahead of the authority, with the units GatherUnitsRaisedWith adds.
  • RaiseUnitLevelOnAuthorityAuthority: confirms Level for the unit and the units GatherUnitsRaisedWith adds, replicates it, plays it here and tells OnUnitsRaisedOnAuthority.
  • CancelPredictionRolls the unit's prediction back to the confirmed level, and with it the predictions of the units GatherUnitsRaisedWith adds.
  • ApplyGenerationAny machine: the first generation this component learns (from here or from its replicated levels) is taken whatever it is; after that a newer one puts every unit back to intact here at once, and an equal or older one is ignored.
  • FindUnitForPrimitiveThe unit the primitive (and the instance of it, ItemIndex) stands for, or INDEX_NONE.

Events