Is it possible to turn off destruction of mesh until I trigger it?

I’ve created an actor and attached a UDestructibleComponent to it. I have been able to successfully set it to destroy, with the following settings:

	// Lastly, create the Mesh component and attach it to the capsule.
	InteractableDestructibleMesh = CreateDefaultSubobject<UDestructibleComponent>(TEXT("ItemMesh"));

	// Simulate physics and notify rigid body collision.

However, I only want to trigger it when I want to. For example:

///*If this is turned on, that means this item can be destroyed at high velocity*/
	FVector velocity = GetVelocity();
	float speed = velocity.Size();
if (speed > 750.0f)
    // Set to destructible
    // Perform other tasks here, such as deactivate components, destroy attached arrays, etc.

I’ve been digging around to find any sort of trigger. However, the API docs located here brings up a 404 error, and I have not been able to find any sort of documentation that would help me with this.

I’ll note that I tried disabling collision, but unfortunately this stops me from interacting with the object at all. I’ve also created a capsule wrapper (root component) and attempted to create physics for it, but it didn’t seem to work.

The API does seem to be down right now…

I’ve never really looked at the destructible actor, but I’m assuming it will start it’s destruction when it takes damage. If this is the case then maybe overriding the ApplyDamage method will allow you to perform some additional logic before actually applying that damage. E.g.

void UMyComponent::ApplyDamage(float DamageAmount, const FVector& HitLocation, const FVector& ImpulseDir, float ImpulseStrength)

Link to the UDestructableComponent class in case it helps:

This is exactly what I am looking for. So, to flesh it out a little more, I created a DestructibleComponentOverride class, and added 2 functions:

	virtual void ApplyDamage(float DamageAmount, const FVector& HitLocation, const FVector& ImpulseDir, float ImpulseStrength) override;

    UPROPERTY(EditAnywhere, Category = "Custom|Interactable Properties")
	bool bAllowDamage;	

Then, I changed my component into my newly created component:

	UPROPERTY(EditAnywhere, Category = "Interactable Properties")
		class UDestructibleOverrideComponent* InteractableDestructibleMesh;

Then, when the object is triggered, I flip the bool, causing damage:

InteractableDestructibleMesh->bAllowDamage = true;

Which will cause the object in question to take damage the next time physics takes its course.

As a side note, I am noticing that the convention b follows all boolean values in Unreal.

Glad it works and thanks for sharing this for others.

And you’re right, the UE4 naming conventions for bool is bMyBoolName. If you’re interested, there are some more standards here: Coding Standard | Unreal Engine Documentation (I can’t say I follow all of them strictly just out of habit, I still like to prefix my member variables with m_ etc)