Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

REFERENCECOMPONENTS

UCFHingeComponent

MODULECrushformINCLUDECFHingeComponent.hPARENTUSceneComponent

The hinge of a part of the body: a door, a hood, a tailgate, a bumper. Its location is the hinge pin and its Z axis the pin's direction, unless it has Mounts: then the part hangs on one of them, the one the crash left whole (a bumper on the end still bolted on). The part is the one static mesh attached directly under it; whatever goes with the part (glass, a handle) hangs under the part.

UCFDeformComponent decides from the dents around the part and at its pin when it starts to swing and when it comes off; the hinge carries that out on the machine it runs on. Local to this machine: nothing of the hinge replicates.

Functions

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

Finds the part (FindPart) and records where it sits. False, with a warning, when there is no part or more than one.

UStaticMeshComponent* FindPart() const
PUREC++ ONLY

The only static mesh attached directly under the hinge, or null when there is none or more than one. InitPart takes it.

int32 GetNumPins() const
PUREC++ ONLY

Mounts.Num(), or 1 for the hinge itself when there are none.

FTransform GetPinTransform(int32 PinIndex) const
PUREC++ ONLY

Pin PinIndex in world space: the mount's transform on the hinge's, or the hinge's own. The pin is its Z axis. An index out of range reads pin 0.

float GetPinOpenAngle(int32 PinIndex) const
PUREC++ ONLY

The travel of pin PinIndex, degrees: the mount's Open Angle, or the hinge's. An index out of range reads pin 0.

int32 GetActivePin() const
PUREC++ ONLY

The pin the part swings on: the one StartSwinging was handed, 0 while attached.

float GetSwingTravel() const
PUREC++ ONLY

Sum of the swing's turns since StartSwinging, degrees, counting only turns faster than CFHinge::ShakeMinSpeed.

bool StartSwinging(bool bBreakable = false, int32 PinIndex = 0)
C++ ONLY

Hangs the part on a joint to the owner's body, about pin PinIndex (GetNumPins; one out of range is pin 0). bBreakable: the joint tears under Break Force or Break Torque (OnTorn), once armed as SetBreakable arms it; only the machine that decides detaches asks for it. False when the part is not attached, the owner has no simulating physics body, or something stands in the part's place (IsPartBlocked).

void SetBreakable(bool bBreakable)
C++ ONLY

From now on a swinging part's joint tears under Break Force or Break Torque, or stops tearing. The joint arms once it has carried no more than UCFSettings::ArmLoadShare of either for CFHinge::ArmQuietTime (IsJointArmPending until then). No effect unless the part swings on a joint.

void SetImpactSourceHere(const bool bSourceHere)
C++ ONLY

Tells the hinge whether this machine is its owner's impact source, the one that simulates the body; the deform component hands it on every tick (UCFDeformComponent::SyncHingeBreakable). Only there does a swinging part get its Bump Response push: where the body is played back, its network corrections would read as jolts. False until told.

void Detach(bool bHideAtOnce)
LOCALC++ ONLY

Lets the part fall off and starts its lifetime. Local to this machine. bHideAtOnce hides it instead: it came off before this machine saw the body. A part still in its place stays there, off, while another vehicle is close to the place or something stands in it (IsPartCrowded), or until its cut lands (SetAwaitingCut), and falls once that has moved off.

void Reattach()
C++ ONLY

Puts the part back where the Blueprint put it: no joint, no physics, no collision, visible.

float GetOpenAngle() const
PUREC++ ONLY

Angle of the part about the active pin from where the Blueprint put it, degrees; it has that pin's Open Angle's sign while opening.

bool IsPartBlocked() const
PUREC++ ONLY

Whether something other than the owner stands in the part's closed place: a vehicle still pressing on the dent it made, a wall. A body made for the part there would be shoved out through the owner's own (the joint keeps the two from touching) and flung once it tore loose; the part keeps still instead.

bool IsPartCrowded() const
PUREC++ ONLY

Whether a vehicle other than the owner is within UCFSettings::TornPartHoldMargin of the part's closed place, or closing in fast enough to be there within TornPartHoldLookahead, or anything stands in the place (IsPartBlocked): the vehicle that tore the part off, still driving in. A part let go then comes off between two bodies both infinitely heavy to it (one-way, LoosenPart) and is shot out or wedged into its own body.

bool IsPartHeld() const
PUREC++ ONLY

Whether a part that came off still waits in its closed place to fall (Detach): for the body's collision to be cut out of that place (SetAwaitingCut), or while a vehicle is close to it (IsPartCrowded).

void SetAwaitingCut(bool bInAwaitingCut)
C++ ONLY

Holds a part that came off in its closed place until its cut lands: the body's collision takes the place out of the body first, so the part never falls into the body it came from. False lets it fall, at once unless a vehicle is close to the place (IsPartCrowded).

bool IsAwaitingCut() const
PUREC++ ONLY

Whether the part waits for its cut to land (SetAwaitingCut).

void BeginDetachAfterCut()
C++ ONLY

Lets a swinging part come off once its cut lands: it keeps swinging on its joint until then, and a joint that tears meanwhile is not put back. Only a part that is swinging takes it; the part then falls off its joint when the cut lands.

bool IsDetachPending() const
PUREC++ ONLY

Whether a swinging part keeps its joint until its cut lands (BeginDetachAfterCut).

ECFHingeState GetState() const
PURE

Where the part is in its life: attached, swinging on a joint, or detached.

Category
Crushform|Hinge
UStaticMeshComponent* GetPart() const
PURE

The static mesh this hinge moves; null before InitPart finds it.

Category
Crushform|Hinge
UPhysicsConstraintComponent* GetJoint() const
PUREC++ ONLY

The physics constraint a swinging part hangs on; null unless the part is swinging.

bool IsPartHidden() const
PUREC++ ONLY

Whether the part has been hidden after it sank.

FTransform GetPartReadPose() const
PUREC++ ONLY

The part's pose where the owner's body reads now, carried onto the body (CFDeform::GetBodyRootTransform): a skeletal root follows its body only in its own EndPhysics tick, a frame's travel behind it in a physics hit, where a dent swings and detaches parts. Attached, from the component, which the owner's root holds. Freshly placed, from PlacedOnBody: in a hit the engine has just moved the component to its body's pose as last set, the lead ahead, and RideUnread brings it back only after physics. Its component's own pose once it follows its own body.

const UPrimitiveComponent* GetPartReadBody() const
PUREC++ ONLY

The body whose motion GetPartReadPose follows: the owner's, the part's own once it follows its own body; null for a part with neither.

bool IsJointBreakable() const
PUREC++ ONLY

Whether the joint now stands armed to tear. False without a joint, and while an arm SetBreakable asked for waits for the load to drop.

bool IsJointArmPending() const
PUREC++ ONLY

Whether the joint was asked to arm and waits: it has not yet carried little enough for long enough (SetBreakable).

bool IsImpactSourceHere() const
PUREC++ ONLY

Whether this machine is the owner's impact source, as last told (SetImpactSourceHere).

Properties

float OpenAngle = 70.0f

Travel from where the Blueprint put the part (closed) to fully open, degrees about the hinge's Z axis. Its sign picks the side the part opens to. With Mounts, each mount's own Open Angle is used; this one only seeds Add Mount.

Default
70.0f
Category
Hinge
float PartMass = 20.0f

Mass of the part while it swings or lies loose, kg.

Default
20.0f
Category
Hinge
bool bOverrideDentedPartCollision = false

Overrides the profile's Dented Part Collision for this part.

Default
false
Category
Hinge
bool bDentedPartCollision = false

Whether this part, once loose, collides as one hull of its dented collision, in place of the profile's Dented Part Collision. Off: it keeps its static mesh's simple collision exactly as the asset has it, undented, as a concave part such as a bumper wants. Read when play begins: a change on a running vehicle takes effect when it spawns again.

Default
false
Category
Hinge
float SwingThreshold = 8.0f

Deepest dent around the part, cm, at which it starts to swing. Keep it under Detach Pin Threshold and at or under Detach Mean Threshold.

Default
8.0f
Category
Hinge
float DetachMeanThreshold = 20.0f

Mean dent over the part, cm, that takes it off: the part crushed as a whole, not one deep dent in a corner of it. Reaching Detach Pin Threshold instead takes it off too.

Default
20.0f
Category
Hinge
float DetachPinThreshold = 30.0f

Deepest dent within Pin Radius of the pin, cm, that takes it off: what holds the part is crushed. Reaching Detach Mean Threshold instead takes it off too. Keep the lower of the two under the profile's Max Displacement and under the Max Depth of the stiffness zones around the part, or a dent never takes it off (the component logs a warning).

Default
30.0f
Category
Hinge
float PinRadius = 40.0f

How far from the pin, cm, a dent counts as one at the pin.

Default
40.0f
Category
Hinge
float BreakForce = 9200.0f

Force on the pin, N, that tears a swinging part off: a vehicle running into an open door. 0 never does. The default is twice the measured one: at 4600 N a 1500 kg body at 1 m/s leaves a test door on, at 20 km/h tears it off; parts are tuned to hold harder than that. Only on the machine that decides detaches (the driver's, or the server for a body nobody drives); elsewhere the joint holds and the part comes off through the detach every player gets.

Default
9200.0f
Category
Hinge
float BreakTorque = 5200.0f

Torque on the pin, N*m, that tears a swinging part off; 0 never does. As Break Force: twice the measured 2600 N*m.

Default
5200.0f
Category
Hinge
TArray<FCFHingeMount> Mounts

Points the part may hang on once loose, in the hinge's space: a bumper's two ends. When the part starts to swing it hangs on the mount whose surroundings are dented least (the first of equals) and swings about that mount's Z axis; a dent at a mount it does not hang on never takes it off. Empty: the part swings about the hinge's own Z axis by Open Angle.

Category
Hinge
bool bOverrideSwingDamping = false

Overrides the project's Swing Damping for this part.

Default
false
Category
Hinge
float SwingDamping = 1.0f

Damping of this part's swing, in place of the project's Swing Damping (Project Settings > Plugins > Crushform).

Default
1.0f
Category
Hinge
bool bOverrideSwingSpring = false

Overrides the project's Swing Spring for this part.

Default
false
Category
Hinge
float SwingSpring = 0.0f

Spring pulling this part back to closed, in place of the project's Swing Spring (Project Settings > Plugins > Crushform). A bumper that hangs on one mount wants none.

Default
0.0f
Category
Hinge
bool bOverrideStopBounce = false

Overrides the project's Stop Bounce for this part.

Default
false
Category
Hinge
float StopBounce = 0.0f

Bounce of this part off the ends of its travel, in place of the project's Stop Bounce (Project Settings > Plugins > Crushform).

Default
0.0f
Category
Hinge
bool bOverrideBumpResponse = false

Overrides the project's Bump Response for this part.

Default
false
Category
Hinge
float BumpResponse = 0.0f

Extra push this part gets from its body's jolts, in place of the project's Bump Response (Project Settings > Plugins > Crushform).

Default
0.0f
Category
Hinge
float ShakeOffTravel = 0.0f

Degrees the part must have swung, in all, to be shaken off: a bumper hanging on one mount falls off on a rough road. Counted from the start of the swing, so the part's own opening and the swings that follow it count too: keep it well above the Open Angle of its pins (two to three times), or the part comes off on a smooth road as soon as it has swung for the settle time. Acted on only after the settle time; turns too slow to be a shake (a part trembling at rest) do not count. 0: never shaken off.

Default
0.0f
Category
Hinge

Events

FCFOnHingeTornDelegate OnTorn
C++ ONLY
(UCFHingeComponent*)

On the tick after the joint of a swinging part tore. UCFDeformComponent takes the part off for everyone.

FCFOnHingeStopHitDelegate OnStopHit
C++ ONLY
(UCFHingeComponent*, const FCFHingeStopHit&)

On the tick a swinging part is seen to slam into an end of its travel: the joint's stop, at the closed end where the part meets its own body (the joint keeps the two from touching, so no contact reports it). Local to this machine: it fires on every machine that runs the hinge's physics, from that machine's own swing, and nothing of it replicates.

FCFOnHingeStopHitDynamicDelegate OnStopHitDynamic
(UCFHingeComponent* Hinge, const FCFHingeStopHit& Hit)

OnStopHit for Blueprints, with the same hit, told on the world's next timer tick (see On Started Swinging).

Category
Crushform|Hinge
FCFOnHingeChangedDynamicDelegate OnStartedSwinging
(UCFHingeComponent* Hinge)

The part came loose and starts to swing on its hinge. Fires on every machine that runs the hinge's physics (every machine that draws, never a dedicated server), from what that machine itself sees, and nothing of it replicates. A part crushed off straight from its place comes off without swinging first. Told on the world's next timer tick, as the deform component's On Damage Changed, not inside the call that changed the part: a handler may repair or destroy the vehicle. Get State reads the state now, which a later change may have moved on.

Category
Crushform|Hinge
FCFOnHingeDetachedDynamicDelegate OnDetached
(UCFHingeComponent* Hinge, bool bHiddenAtOnce)

The part came off the body, once per part until a repair. Where, from what and when as On Started Swinging. bHiddenAtOnce: it was already off when this machine first saw the vehicle (a player who joins late, a vehicle replicating in), so it is hidden instead of seen falling: update what the game shows, play no effect. That one is told on the first timer tick after the vehicle's BeginPlay, so Event BeginPlay can bind it.

Category
Crushform|Hinge
FCFOnHingeChangedDynamicDelegate OnReattached
(UCFHingeComponent* Hinge)

A swinging or detached part is back where the Blueprint put it: a repair, or a swing whose joint tore on a machine that no longer decides detaches (the part stays on for every player). Where, from what and when as On Started Swinging.

Category
Crushform|Hinge