Multiple footstep sounds on landscape

After watching this Tutorial and reading through THIS I set up foot steps oon my character. Now I’m asking how would I set up footsteps on a landscape with mutible textures applied and painted around. I have leaves, dirt, ice, and grass in my landscape material.

We are doing this through Physical Material. It has to be set in Project Settings->Physics->PhysicalSurface and assigned to your materials.

I then fire a raycast straight below the actor to determine what’s down there and fill FText CurrentSurface which contains name of the surface actor is currently on. When you get this text, it’s just a question of a switch.

Btw. I am doing this in C++ for sake of speed but since this is Blueprints section, you can at least get some basic idea about what nodes to look for.

void ATheForestCharacter::TracePhysicalSurface()
{
	FVector StartTrace = FVector::ZeroVector;
	FVector CamLoc;
	FVector target;
	FCollisionQueryParams TraceParams;
	FHitResult currentHit;


	CamLoc = FirstPersonCameraComponent->GetComponentTransform().GetLocation();

	target = CamLoc + FVector(0.0f, 0.0f, -300.0f);

	TraceParams = FCollisionQueryParams(false);
	TraceParams.AddIgnoredActor(this);

	GetWorld()->LineTraceSingleByChannel(currentHit, CamLoc, target, ECollisionChannel::ECC_MAX, TraceParams);
	
	UPhysicalMaterial* physMat = NULL;


	if (currentHit.IsValidBlockingHit())
	{


		UPrimitiveComponent* comp = currentHit.GetComponent();
		if (comp)
		{
			UMaterialInterface*  mat = comp->GetMaterial(0);
			if (mat)
			{
				physMat = mat->GetPhysicalMaterial();
			}
		}


		if (physMat)
		{
			const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, TEXT("EPhysicalSurface"), true);
			if (EnumPtr)
			{
				CurrentSurface = EnumPtr->GetEnumText(physMat->SurfaceType);
			}

		}
	}
}

I’ve figured it out about 5 minutes after posting. I went into the layerinfo for the landscape material

75994-1.png

I added the Physical Material there, and the sound blends nicely after tweaking it. Now when other people look at this, they’ll have the C++ and the blueprint way. Thank you

Is there a way to do this and detect on an auto blending landscape layer. Maybe the most prominent material would be the one to define the surface type of that area?

So you wanted to marge two different sounds together when the character steps on a blended material. I’ve never done that, but maybe that can be done through BP. I would give more information, but I’m not the best programmer. I just copy and paste what I see on YouTube. I’m replying to let you know I see your comment and I didn’t wanna leave you line here.