UDestructibleComponent

Inheritance Hierarchy

Syntax

class UDestructibleComponent : public USkinnedMeshComponent

Remarks

This component holds the physics data for a DestructibleActor.

The USkeletalMesh pointer in the base class (SkinnedMeshComponent) MUST be a DestructibleMesh

Variables

Name Description

Public variable

bool

 

bEnableHardSleeping

Enable "hard sleeping" for destruction-generated PxActors.

Public variable

uint32 : 1

 

bFractureEffectOverride

If set, use this actor's fracture effects instead of the asset's fracture effects.

Public variable

TArray < FDestru ...

 

ChunkInfos

WITH_EDITORONLY_DATA.

Public variable

UDestructibleMe ...

 

DestructibleMesh

Provide a blueprint interface for setting the destructible mesh

Public variable

TArray < struct ...

 

FractureEffects

Fracture effects for each fracture level. Used only if Fracture Effect Override is set.

Public variable

float

 

LargeChunkThreshold

The minimum size required to treat chunks as Large.

Public variable

FComponentFract ...

 

OnComponentFracture

Called when a component is touched

Public variable

TArray < FPhysxU ...

 

PhysxChunkUserData

User data wrapper for the chunks passed to physx

Constructors

Name Description

Public function

UDestructibleComponent

(
    const FObjectInitializer & ObjectIn...
)

============================================================================= DestructibleComponent.cpp: UDestructibleComponent methods.

Functions

Name Description

Public function Virtual

void

 

ApplyDamage

(
    float DamageAmount,
    const FVector & HitLocation,
    const FVector & ImpulseDir,
    float ImpulseStrength
)

Take damage.

Public function Virtual

void

 

ApplyRadiusDamage

(
    float BaseDamage,
    const FVector & HurtOrigin,
    float DamageRadius,
    float ImpulseStrength,
    bool bFullDamage
)

Take radius damage.

Public function Static

int32

 

BoneIdxToChunkIdx

(
    int32 BoneIdx
)

Public function Static

int32

 

ChunkIdxToBoneIdx

(
    int32 ChunkIdx
)

Public function

UDestructibl ...

 

GetDestructibleMesh()

Public function

bool

 

IsChunkLarge

(
    physx::PxRigidActor* ChunkActo...
)

Public function

void

 

SetChunkVisible

(
    int32 ChunkIndex,
    bool bInVisible
)

WITH_APEX.

Public function

void

 

SetChunkWorldRT

(
    int32 ChunkIndex,
    const FQuat & WorldRotation,
    const FVector & WorldTranslation
)

This method sets a chunk's (fractured piece's) world rotation and translation.

Public function

void

 

SetDestructibleMesh

(
    UDestructibleMesh * NewMesh
)

Overridden from USkinnedMeshComponent

Name Description

Public function Virtual

void

 

RefreshBoneTransforms

(
    FActorComponentTickFunction * T...
)

Update functions Refresh Bone Transforms Each class will need to implement this function Ideally this function should be atomic (not relying on Tick or any other update.)

Public function Virtual

void

 

SetSkeletalMesh

(
    USkeletalMesh * NewMesh,
    bool bReinitPose
)

Change the SkeletalMesh that is rendered for this Component.

Public function Virtual

bool

 

ShouldUpdateTransform

(
    bool bLODHasChanged
)

Should update transform in Tick

: return true if need transform update. false otherwise.

Overridden from UPrimitiveComponent

Name Description

Public function Virtual

void

 

AddForce

(
    FVector Force,
    FName BoneName,
    bool bAccelChange
)

Add a force to a single rigid body.

Public function Virtual

void

 

AddForceAtLocation

(
    FVector Force,
    FVector Location,
    FName BoneName
)

Add a force to a single rigid body at a particular location in world space.

Public function Virtual

void

 

AddForceAtLocationLocal

(
    FVector Force,
    FVector Location,
    FName BoneName
)

Add a force to a single rigid body at a particular location.

Public function Virtual

void

 

AddImpulse

(
    FVector Impulse,
    FName BoneName,
    bool bVelChange
)

Add an impulse to a single rigid body. Good for one time instant burst.

Public function Virtual

void

 

AddImpulseAtLocation

(
    FVector Impulse,
    FVector Location,
    FName BoneName
)

Add an impulse to a single rigid body at a specific location.

Public function Virtual

void

 

AddRadialForce

(
    FVector Origin,
    float Radius,
    float Strength,
    ERadialImpulseFalloff Falloff,
    bool bAccelChange
)

Add a force to all bodies in this component, originating from the supplied world-space location.

Public function Virtual

void

 

AddRadialImpulse

(
    FVector Origin,
    float Radius,
    float Strength,
    ERadialImpulseFalloff Falloff,
    bool bVelChange
)

Add an impulse to all rigid bodies in this component, radiating out from the specified position.

Public function Virtual

bool

 

CanEditSimulatePhysics()

Determines whether or not the simulate physics setting can be edited interactively on this component

Public function Virtual

bool

 

DoCustomNavigableGeometryExport

(
    FNavigableGeometryExport & GeomExpo...
)

WITH_APEX.

Public function Virtual

FBodyInstanc ...

 

GetBodyInstance

(
    FName BoneName,
    bool bGetWelded
)

Get a BodyInstance from this component.

Public function Virtual

UBodySetup &...

 

GetBodySetup()

Return the BodySetup to use for this PrimitiveComponent (single body case)

Public function Virtual

bool

 

LineTraceComponent

(
    FHitResult & OutHit,
    const FVector Start,
    const FVector End,
    const FCollisionQueryParams & Param...
)

Trace a ray against just this component.

true if a hit is found

Public function Virtual

void

 

ReceiveComponentDamage

(
    float DamageAmount,
    FDamageEvent const& DamageEvent,
    AController * EventInstigator,
    AActor * DamageCauser
)

WITH_EDITOR.

Public function Virtual

void

 

SetCollisionEnabled

(
    ECollisionEnabled::Type NewType
)

Controls what kind of collision is enabled for this body

Public function Virtual

void

 

SetCollisionResponseToAllChannels

(
    ECollisionResponse NewResponse
)

Changes all ResponseToChannels container for this PrimitiveComponent. to be NewResponse

Public function Virtual

void

 

SetCollisionResponseToChannel

(
    ECollisionChannel Channel,
    ECollisionResponse NewResponse
)

Changes a member of the ResponseToChannels container for this PrimitiveComponent.

Public function Virtual

void

 

SetCollisionResponseToChannels

(
    const FCollisionResponseContainer &...
)

Changes the whole ResponseToChannels container for this PrimitiveComponent.

Public function Virtual

void

 

SetEnableGravity

(
    bool bGravityEnabled
)

Enables/disables whether this component is affected by gravity.

Public function Virtual

void

 

SetMaterial

(
    int32 ElementIndex,
    UMaterialInterface * Material
)

Changes the material applied to an element of the mesh.

Public function Virtual

void

 

SetSimulatePhysics

(
    bool bSimulate
)

Sets whether or not a single body should use physics simulation, or should be 'fixed' (kinematic).

Public function Virtual

bool

 

SweepComponent

(
    FHitResult & OutHit,
    const FVector Start,
    const FVector End,
    const FQuat & ShapeWorldRotation,
    const FCollisionShape & CollisionSh...,
    bool bTraceComplex
)

Trace a shape against just this component.

true if a hit is found

Public function Virtual

void

 

WakeRigidBody

(
    FName BoneName
)

'Wake' physics simulation for a single body.

Overridden from USceneComponent

Name Description

Public function Virtual

FBoxSphereBo ...

 

CalcBounds

(
    const FTransform & LocalToWorld
)

WITH_APEX.

Public function Virtual

FTransform

 

GetSocketTransform

(
    FName InSocketName,
    ERelativeTransformSpace TransformSp...
)

Get world-space socket transform.

Public function Virtual

bool

 

IsAnySimulatingPhysics()

Returns whether the specified body is currently using physics simulation

Public function Virtual

void

 

OnUpdateTransform

(
    EUpdateTransformFlags UpdateTransfo...,
    ETeleportType Teleport
)

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

Activate

(
    bool bReset
)

Activates the SceneComponent

Public function Virtual

void

 

Deactivate()

Deactivates the SceneComponent.

Public function Virtual

void

 

OnActorEnableCollisionChanged()

Called on each component when the Actor's bEnableCollisionChanged flag changes

Protected function Virtual

void

 

OnCreatePhysicsState()

Physics.

Protected function Virtual

void

 

OnDestroyPhysicsState()

Used to shut down and physics engine structure for this component

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent & PropertyCha...
)

WITH_PHYSX.

Public function Virtual

void

 

Serialize

(
    FArchive & Ar
)

WITH_EDITOR.

References

Module

Engine

Header

Runtime/Engine/Classes/Components/DestructibleComponent.h