Description

If a static mesh component has Simulate Physics enabled, GetRelativeTransform() returns the value of world transform.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add code to project based on Actor (MyActor)
  3. Add the following to MyActor.h
    	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "mesh")
    		UStaticMeshComponent* comp;
    	
    	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "mesh")
    		USceneComponent* Scene;
    
  4. Add the following to MyActor.cpp
    • At the top of the file with other include statements
      #include "Engine.h"
      
    • Inside MyActor::MyActor()
      	comp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Comp"));
      	Scene = CreateDefaultSubobject<USceneComponent>(TEXT("Scene"));
      
      	RootComponent = Scene;
      
    • Inside BeginPlay()
      	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());
      	}
      
  5. Compile
  6. In editor, create a Blueprint based on MyActor (MyActorBP)
  7. Set comp to cube mesh and position at relative location of (0,0,100)
  8. Add instance of blueprint to the level
  9. PIE (1)
  10. Exit PIE and set Simulate Physics for the mesh to true
  11. PIE (2)

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

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

By Design
ComponentUE - Gameplay
CreatedMay 3, 2016
ResolvedMay 4, 2016
UpdatedJul 14, 2021
View Jira Issue