StaticMesh Collision Presets / Collision Object type information is not readable from an Object of UStaticMesh?

Hi!
I can’t access Collision Profile / Collision Preset information, wich I set up in the Static Mesh Editor UI, in C++… Where I can access this information? Even the BodySetup just shows me an Enum with BodyCollisionEnabled or Disabled / A TraceTag with Simple/Complex Collision is used…
Unbenannt1


Pls tell me where do they hide that information as i got no time to dig throught every c++ class -_-
Much love for all!

You can use the following functions:

Mesh->GetCollisionObjectType();
Mesh->GetCollisionProfileName();

Here is an example and having this information added to the log:

// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
	Super::BeginPlay();
	const ECollisionChannel Type = StaticMesh->GetCollisionObjectType();
	UE_LOG(LogTemp, Warning, TEXT("Object Type: %s"), *UEnum::GetDisplayValueAsText(Type).ToString());
	
	const FName ProfileName = StaticMesh->GetCollisionProfileName();
	UE_LOG(LogTemp, Warning, TEXT("Profile Name: %s"), *ProfileName.ToString());
	
}

The result is this:

image

I hope this helps, and good luck :slight_smile:

Well, thanks for the answer but u got me wrong ;(
In your case, you are accessing the UStaticMeshComponent and well yeah, there we got those informations, as I need to set it in exactly that kinda Component!
(UFoliageInstancedStaticMeshComponent)
I can Get and Set Collision Values in the specific UFoliageType_InstancedStaticMesh, but I want to READ from my RAW UStaticMesh.uasset!
Probably I need to create Foliage Assets where that Data get stored but this doesn’t answer my question… where does they store that collision profiles from my StaticMesh.uassets?
LOL true ninja values

try this:
// UStaticMesh Mesh;

Mesh.GetBodySetup()->DefaultInstance.GetCollisionProfileName()