UDestructibleComponent

This component holds the physics data for a DestructibleActor.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

ApexDestruction

Header

/Engine/Plugins/Runtime/ApexDestruction/Source/ApexDestruction/Public/DestructibleComponent.h

Include

#include "DestructibleComponent.h"

Syntax

UCLASS(ClassGroup=Physics,
       HideCategories=(Object, Mesh, "Components|SkinnedMesh", Mirroring, Activation, "Components|Activation"),
       Config=Engine, EditInlineNew, Meta=(BlueprintSpawnableComponent))
class UDestructibleComponent :
    public USkinnedMeshComponent,
    public IDestructibleInterface

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 UProperty Category, EditAnywhere BlueprintReadWrite

bool

 

bEnableHardSleeping

Enable "hard sleeping" for destruction-generated PxActors.

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

uint32: 1

 

bFractureEffectOverride

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

Public variable UProperty Category, EditAnywhere BlueprintReadWrite Transient

UDestructibleMe...

 

DestructibleMesh

Provide a blueprint interface for setting the destructible mesh

Public variable UProperty Category, EditAnywhere BlueprintReadOnly editfixedsize

TArray< struct ...

 

FractureEffects

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

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

float

 

LargeChunkThreshold

The minimum size required to treat chunks as Large.

Public variable UProperty Category BlueprintAssignable

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...
)

Functions

Name Description

Public function Static

int32

 

BoneIdxToChunkIdx

(
    int32 BoneIdx
)

Public function Static

int32

 

ChunkIdxToBoneIdx

(
    int32 ChunkIdx
)

Public function UFunction BlueprintCallable, Category

UDestructibl...

 

GetDestructibleMesh()

Public function Const

bool

 

IsChunkLarge

(
    physx::PxRigidActor* ChunkActo...
)

Public function

void

 

SetChunkVisible

(
    int32 ChunkIndex,
    bool bInVisible
)

This method makes a chunk (fractured piece) visible or invisible.

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 UFunction BlueprintCallable, Category

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 Const

bool

 

ShouldUpdateTransform

(
    bool bLODHasChanged
)

Should update transform in Tick

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 Const

bool

 

DoCustomNavigableGeometryExport

(
    FNavigableGeometryExport& GeomExpo...
)

Collects custom navigable geometry of component.

Public function Virtual Const

FBodyInstanc...

 

GetBodyInstance

(
    FName BoneName,
    bool bGetWelded
)

Returns BodyInstance of the 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.

Public function Virtual

void

 

ReceiveComponentDamage

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

Event called when a component is 'damaged', allowing for component class specific behaviour

Public function Virtual

void

 

SetCollisionEnabled

(
    ECollisionEnabled::Type NewType
)

Controls what kind of collision is enabled for this body

Public function Virtual

void

 

SetCollisionProfileName

(
    FName InCollisionProfileName
)

Set Collision Profile Name This function is called by constructors when they set ProfileName This will change current CollisionProfileName to be this, and overwrite Collision Setting

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.

Public function Virtual

void

 

WakeRigidBody

(
    FName BoneName
)

'Wake' physics simulation for a single body.

Overridden from USceneComponent

Name Description

Public function Virtual Const

FBoxSphereBo...

 

CalcBounds

(
    const FTransform& LocalToWorld
)

Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size.

Public function Virtual Const

FTransform

 

GetSocketTransform

(
    FName InSocketName,
    ERelativeTransformSpace TransformSp...
)

Get world-space socket transform.

Public function Virtual Const

bool

 

IsAnySimulatingPhysics()

Returns whether the specified body is currently using physics simulation

Public function Virtual

void

 

OnUpdateTransform

(
    EUpdateTransformFlags UpdateTransfo...,
    ETeleportType Teleport
)

Native callback when this component is moved

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

Activate

(
    bool bReset
)

Activates the SceneComponent, should be overridden by native child classes.

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()

Used to create any physics engine information for this component

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...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Overridden from IDestructibleInterface

Name Description

Public function Virtual UFunction BlueprintCallable, Category

void

 

ApplyDamage

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

Take damage.

Public function Virtual UFunction BlueprintCallable, Category

void

 

ApplyRadiusDamage

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

Take radius damage.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback