GetMass() always returns 0 kg

I am trying to create a sphere with a 1 kg mass, then print this mass to the log in the actor Tick function. The actor mesh mass is being initialized at 1 kg, but when I print the mass using the GetMass() function, I always get 0.000…

Any idea how this could be fixed? Thanks.

MyActor.h

#pragma once
include “CoreMinimal.h”
include “GameFramework/Actor.h”
include “MyActor.generated.h”

UCLASS()
class MYPLUGIN_API AMyActor : public AActor
{

GENERATED_BODY()

public:

// Sets default values for this actor's properties

AMyActor();

protected:

// Called when the game starts or when spawned

virtual void BeginPlay() override;

public:

// Called every frame

virtual void Tick(float DeltaTime) override;

UPROPERTY()

USceneComponent* Root;

UPROPERTY(EditAnywhere)

UStaticMeshComponent* Mesh;

};

MyActor.cpp

include “MyActor.h”
include “Components/StaticMeshComponent.h”

// Sets default values

AMyActor::AMyActor()

{

// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.

PrimaryActorTick.bCanEverTick = true;

Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root")); 
RootComponent = Root;

Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh")); 
Mesh->AttachTo(Root); 
Mesh->SetSimulatePhysics(true); 
Mesh->SetMassOverrideInKg("Mesh", 1.0, true);

}

// Called when the game starts or when spawned

void AMyActor::BeginPlay()

{

Super::BeginPlay();

UE_LOG(LogActor, Warning, TEXT("Hello World!"))

}

// Called every frame

void AMyActor::Tick(float DeltaTime)

{

Super::Tick(DeltaTime);

UE_LOG(LogActor, Warning, TEXT("Actor location is: %s"), *this->GetActorLocation().ToString()); 
UE_LOG(LogActor, Warning, TEXT("Actor mass is: %f"), Mesh->GetMass());

}

image

This could very well be why for at least 2 years back. Setting the mass on objects doesn’t change one bit 9f how they react to collisions.
As in a character is able to move items with masses supposedly set to billions of KG anyway.

That said, Mesh could very well be invalid inside ontick.
Preceed it with an
If ( !Mesh) {return;} or similar, just to be sure.

Also, try to output the same on begin play.

And generally speaking be aware that the construction script doesn’t necessarily set values you can access elsewhere.
At least, it doesn’t for setting up the default values of things like skeletal meshes…