# UDestructibleComponent - Weird physics and no child position update

**URL:** <https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596>\
**Category:** World Creation\
**Tags:** root-component, unreal-engine, Destructible, Physics, question\
**Created:** [September 27, 2018, 1:49pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596 "2018-09-27T13:49:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_53b09e6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53b09e6f](https://forums.unrealengine.com/u/anonymous_user_53b09e6f)\
**Post date:** [September 27, 2018, 1:49pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/1 "2018-09-27T13:49:30Z")

</div>

Hi!  
  
I want to have some lightning destructibles falling down, so I wrote this:.

```
ATest::ATest()
{
	DestructibleComponent = CreateDefaultSubobject<UDestructibleComponent>("DMComp");
	Light = CreateDefaultSubobject<UPointLightComponent>("Light");
	DestructibleComponent->SetSimulatePhysics(true);
    GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // shows "false"
	RootComponent = DestructibleComponent;
	Light->SetupAttachment(RootComponent);
}

void ATest::BeginPlay()
{
	Super::BeginPlay();
	GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // Shows "false"
	DestructibleComponent->SetSimulatePhysics(true); // without this line Actor does not fall down
	GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // Shows "false", but actor falls down
}

```

Problem is Light component does not follow DestructibleComponent’s position.  
  
`Light Component` in blueprint has set `mobility` to `movable`   
  
`DestructibleComponent` doesnt have such option to choose, `SimulatePhysics` checkbox also does not appear in blueprint settings.  
  
It’s also a bit confusing why setting simulating physics in BeginPlay allows actor to fall down, but Log shows it’s `false`

---

<div class="post-metadata">

**Author:** ![NicholasMont](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NicholasMont](https://forums.unrealengine.com/u/NicholasMont)\
**Post date:** [September 27, 2018, 5:50pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/2 "2018-09-27T17:50:28Z")

</div>

Hey Testerro,

Can you please provide me with the full .cpp and .h file for this class?

Thank you!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53b09e6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53b09e6f](https://forums.unrealengine.com/u/anonymous_user_53b09e6f)\
**Post date:** [September 27, 2018, 6:31pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/3 "2018-09-27T18:31:52Z")

</div>

Header file:

```
// Authored by me

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/PointLightComponent.h"
#include "DestructibleComponent.h"
#include "Test.generated.h"

UCLASS()
class UNREALARCHERYSHOOTER_API ATest : public AActor
{
	GENERATED_BODY()

public:
	ATest();

protected:
	virtual void BeginPlay() override;

private:
	UPROPERTY(EditAnywhere)
	UDestructibleComponent* DestructibleComponent;

	UPROPERTY(EditAnywhere)
	UPointLightComponent* Light;
};

```

.cpp file (just comment and include header else)

```
// Authored by me

#include "Test.h"

ATest::ATest()
{
	DestructibleComponent = CreateDefaultSubobject<UDestructibleComponent>("DMComp");
	Light = CreateDefaultSubobject<UPointLightComponent>("Light");
	DestructibleComponent->SetSimulatePhysics(true);
	GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // shows "false"
	RootComponent = DestructibleComponent;
	Light->SetupAttachment(RootComponent);
}

void ATest::BeginPlay()
{
	Super::BeginPlay();
	GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // Shows "false"
	DestructibleComponent->SetSimulatePhysics(true); // without this line Actor does not fall down
	GLog->Log(DestructibleComponent->IsSimulatingPhysics() ? TEXT("true") : TEXT("false")); // Shows "false", but actor falls down
}

```

---

<div class="post-metadata">

**Author:** ![NicholasMont](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NicholasMont](https://forums.unrealengine.com/u/NicholasMont)\
**Post date:** [September 27, 2018, 7:55pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/4 "2018-09-27T19:55:31Z")

</div>

Thank you Testerro,

some additional information I’d like to request. Are you currently using unreal engine 4.20? Also, if you could navigate to your UnrealArcheryShooter.Target.cs file, and paste me what you see inside of

```
public UnrealArcheryShooterTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Game;

		ExtraModuleNames.AddRange( new string[] { // Modules should exist here } );
	}

```

Thank you!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53b09e6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53b09e6f](https://forums.unrealengine.com/u/anonymous_user_53b09e6f)\
**Post date:** [September 28, 2018, 7:15am UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/5 "2018-09-28T07:15:33Z")

</div>

Yes, I use 4.20.3 version  
  
UnrealArcheryShooter.Target.cs has

```
public UnrealArcheryShooterTarget(TargetInfo Target) : base(Target)
{
	Type = TargetType.Game;

	ExtraModuleNames.AddRange( new string[] { "UnrealArcheryShooter" } );
}

```

UnrealArcheryShooter.Build.cs has

```
public UnrealArcheryShooter(ReadOnlyTargetRules Target) : base(Target)
{
	PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "ApexDestruction" });
	PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
}

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53b09e6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53b09e6f](https://forums.unrealengine.com/u/anonymous_user_53b09e6f)\
**Post date:** [October 1, 2018, 8:02am UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/6 "2018-10-01T08:02:38Z")

</div>

It’d be nice to know what’s wrong, because I haven’t found any better solution than crazy manual tracking position in code

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2c429cad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2c429cad](https://forums.unrealengine.com/u/anonymous_user_2c429cad)\
**Post date:** [October 8, 2018, 9:58pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/7 "2018-10-08T21:58:52Z")

</div>

Hello,

Try replacing `DestructibleComponent->SetSimulatePhysics(true);` with `DestructibleComponent->GetBodyInstance()->SetInstanceSimulatePhysics(true);`

Thanks

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_53b09e6f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_53b09e6f](https://forums.unrealengine.com/u/anonymous_user_53b09e6f)\
**Post date:** [October 9, 2018, 2:16pm UTC](https://forums.unrealengine.com/t/udestructiblecomponent-weird-physics-and-no-child-position-update/434596/8 "2018-10-09T14:16:06Z")

</div>

Yes! That did the job.  
Thank you very much.
