If a static mesh component has Simulate Physics enabled, GetRelativeTransform() returns the value of world transform.
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "mesh") UStaticMeshComponent* comp; UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "mesh") USceneComponent* Scene;
#include "Engine.h"
comp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Comp")); Scene = CreateDefaultSubobject<USceneComponent>(TEXT("Scene")); RootComponent = Scene;
UE_LOG(LogTemp, Warning, TEXT("world transform=%s"), *comp->GetComponentTransform().ToString()); UE_LOG(LogTemp, Warning, TEXT("relative transform=%s"), *comp->GetRelativeTransform().ToString()); if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::Magenta, *comp->GetComponentTransform().ToString()); GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::Cyan, *comp->GetRelativeTransform().ToString()); }
Result:
PIE(1) reports relative transform in game and logs as expected. PIE(2) reports relative transform as the exact same as World transform
Expected:
Simulate Physics does not affect relative transform
Repro Rate:
3/3
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay |
---|
Created | May 3, 2016 |
---|---|
Resolved | May 4, 2016 |
Updated | Jul 14, 2021 |