Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

REFERENCEACTORS

ACFBreakableTree

MODULECrushformBreakableINCLUDECFBreakableTree.hPARENTAActor

One physical trunk body for its whole life: standing, bending, falling or bent-and-locked, and finally frozen into static geometry.

Standing is a kinematic body with no joint, dormant from BeginPlay -- a level-placed forest costs nothing until UCFPropContactComponent arms it. Yielding is decided by angle: the authority crosses YieldAngleDegrees and commits, while a client predicts the same crossing and starts falling locally with zero latency -- fading the drive spring out is an ordinary, reversible joint mutation, unlike a broken joint or a migrated plastic drive target. A client only releases the joint (FellAndFall's hard finish) once the authority's bYielded actually confirms the prediction; an unconfirmed one rolls back.

A tree can also be drawn by a skinned mesh animated by Dynamic Wind (TrunkSkinnedMesh). It is a pure visual riding the same trunk body: when it has a mesh at construction/BeginPlay, TrunkMesh is hidden and stays only as the physics body and collision proxy, so every rule above still runs on TrunkMesh alone.

Functions

AUTHORITY · server, every machineLOCAL · this machinePURE · read only
UStaticMeshComponent* GetTrunkMesh() const
PUREC++ ONLY

The trunk's physics body and collision proxy. Hidden when TrunkSkinnedMesh draws the tree.

UInstancedSkinnedMeshComponent* GetTrunkSkinnedMesh() const
PUREC++ ONLY

The optional skinned mesh that draws the tree instead of TrunkMesh. May have no mesh assigned.

UCFTreeConfig* GetTreeConfig() const
PUREC++ ONLY

The per-species tuning asset. Null if none is assigned.

UPhysicsConstraintComponent* GetTrunkConstraint() const
PUREC++ ONLY

The joint that holds the trunk to the world while the tree is armed.

bool IsArmed() const
LOCAL

Whether a nearby vehicle has armed the tree (its joint exists and it simulates physics). Local to this machine: arming is not replicated.

Category
Crushform|Tree
bool IsYielded() const
PURE

Whether the tree has yielded: a felled trunk has started to fall, or a bent pole has reached its stop. Replicated from the authority.

Category
Crushform|Tree
bool IsSettled() const
PURE

Whether the trunk has frozen into static geometry. Replicated from the authority.

Category
Crushform|Tree
int32 GetRespawnCount() const
PURE

Respawns so far, wrapping at 256. A counter rather than a flag, so a second respawn is still a change the clients see.

Category
Crushform|Tree
bool RespawnNowOnAuthority()
AUTHORITYC++ ONLY

Authority only. Stands a yielded tree (fallen, felling or a locked pole) up at once, by the timer's path, whatever the respawn conditions say. Returns false for a standing tree, or when called on a machine that is not the authority.

bool IsStateChangeFresh() const
PUREC++ ONLY

Whether the last replicated state change (the yield or the settle) is recent enough to be witnessed live. Always true on the authority.

float GetDeflectionDegrees() const
PURE

Current bend angle in degrees, measured from the trunk's own live rotation -- never a value tracked separately.

Category
Crushform|Tree
void Arm()
LOCALC++ ONLY

Local to this machine. Creates the joint and starts simulating physics, or -- if already armed -- just cancels any pending RequestDisarm(). Idempotent and cheap enough to call every tick for every tree a vehicle is near. Refuses (logging once) if TreeConfig is missing or fails UCFTreeConfig::ValidateTreeConfig, and silently while the tree is out of play (before BeginPlay, or after EndPlay from a streamed-out cell).

void RequestDisarm()
LOCALC++ ONLY

Local to this machine. Schedules Disarm() after DisarmDelaySeconds unless something re-Arm()s first. No-op once yielded -- a falling or locked trunk is never turned back into a kinematic body -- and while out of play, as Arm().

void UpdateBendVisual()
C++ ONLY

Writes the joint's current deflection into every trunk mesh's Custom Primitive Data for the WPO bend material (see BendAmountCpdIndex etc). A cheap no-op while not armed.

float ComputeArmRadiusCm(float SpeedCmS, float DeltaSeconds)
C++ ONLY

Radius in cm within which a vehicle arms the trees around it: ArmMinRadiusCm, or the distance the body covers in DeltaSeconds (clamped to 0.1-0.35 s) at a 3x margin, whichever is larger. Arming must land before collision does, since an unarmed tree is a kinematic wall.

Properties

TObjectPtr<UStaticMeshComponent> TrunkMesh

The trunk's physics body and collision proxy.

Category
Crushform|Tree
TObjectPtr<UInstancedSkinnedMeshComponent> TrunkSkinnedMesh
Category
Crushform|Tree
TObjectPtr<UPhysicsConstraintComponent> TrunkConstraint

The joint that holds the trunk to the world while the tree is armed.

Category
Crushform|Tree
TObjectPtr<UCFTreeConfig> TreeConfig
Category
Crushform|Tree
bool bYielded = false

Set by the authority when the tree yields (a felled trunk starts to fall, or a bent pole reaches its stop); replicated.

Default
false
Category
Crushform|Tree
bool bSettled = false

Set by the authority when the trunk freezes into static geometry; replicated.

Default
false
Category
Crushform|Tree

Events

FCFOnTreeHitDynamicDelegate OnHit
(ACFBreakableTree* Tree, AActor* OtherActor, FVector Location, float DeltaVCmS)

Each event fires on every machine, from what that machine itself sees, and is not delivered to a player who joins later.

Category
Crushform|Tree
FCFOnTreeHitDelegate OnHitNative
C++ ONLY
(ACFBreakableTree&, AActor*, const FVector&, float)

Native counterpart of OnHit.

FCFOnTreeYieldedDynamicDelegate OnYielded
(ACFBreakableTree* Tree, bool bPredicted)
Category
Crushform|Tree
FCFOnTreeYieldedDelegate OnYieldedNative
C++ ONLY
(ACFBreakableTree&, bool)

Native counterpart of OnYielded.

FCFOnTreeEventDynamicDelegate OnLanded
(ACFBreakableTree* Tree)
Category
Crushform|Tree
FCFOnTreeEventDelegate OnLandedNative
C++ ONLY
(ACFBreakableTree&)

Native counterpart of OnLanded.

FCFOnTreeEventDynamicDelegate OnSettled
(ACFBreakableTree* Tree)
Category
Crushform|Tree
FCFOnTreeEventDelegate OnSettledNative
C++ ONLY
(ACFBreakableTree&)

Native counterpart of OnSettled.

FCFOnTreeEventDynamicDelegate OnRespawned
(ACFBreakableTree* Tree)
Category
Crushform|Tree
FCFOnTreeEventDelegate OnRespawnedNative
C++ ONLY
(ACFBreakableTree&)

Native counterpart of OnRespawned.

FCFOnTreeEventDynamicDelegate OnYieldRolledBack
(ACFBreakableTree* Tree)
Category
Crushform|Tree
FCFOnTreeEventDelegate OnYieldRolledBackNative
C++ ONLY
(ACFBreakableTree&)

Native counterpart of OnYieldRolledBack.