How to get character mesh in C++ from Character Blueprint?

Hi

I want to make a blueprint in C++ with trigger volume which will give overlaping events only from mesh from character blueprint.

I have character coded in blueprint and I don’t know how to get access for specfic component in C++. If I could get access, I could compare characeter mesh with overlaping actors somehow.

Is there a way to do this?

It is GetMesh()

3 Likes

I think you making a confusion between blueprint and C++.
I guess you wanted to access a mesh component set in your BP from your C++ class (also set in the same BP).

You can implement this function in your class to get the Character Mesh.

USkeletalMeshComponent* ACastable::getCharacterMesh()
{
	USkeletalMeshComponent* mesh = NULL;
	AActor *characterActor = NULL;

	characterActor = this->GetParentActor();
	if (characterActor != NULL)
	{
		mesh = Cast<USkeletalMeshComponent>(characterActor->GetComponentByClass(USkeletalMeshComponent::StaticClass()));
	}
	return (mesh);
}

I know this is an old thread but this could help some people who are looking for the same answer.

3 Likes