Why does GetOverlappingActors not return Landscape

Hello,
I am currently trying to code a component which will manage the GroundFriction for the character by getting the friction value from any static objects that the character is currently touching. In order to do this, I am using the GetOverlappingActors method. This seems to work fine for my needs. But for some reason, the function seems to e ignoring Landscape objects. This is problematic, since the majority of the friction surfaces will be Landscape objects.

Why does GetOverlappingActors not return Landscape objects?

Is there a better function to use? Or is there something that I might be missing?

Thanks in advance.

I would personally do a trace to determine what your actor is currently touching. I do not know exactly why the GetOverlappingActors() would not return the landscape, but sure is not a good way to go for your wanted behavior, since you can have more than one overlapping actor.

Basically the idea would be to do a trace from your actor position to the ground.

You can see a good example of that in that other post :

What is interesting here is this :

GetWorld()->LineTraceSingle(
     RV_Hit,        //result
     Start,    //start
     End, //end
     ECC_Pawn, //collision channel
     RV_TraceParams
 );

I personnaly prefer this one:

bool UWorld::LineTraceSingle(struct FHitResult& OutHit,const FVector& Start,const FVector& End,const struct FCollisionQueryParams& Params, const struct FCollisionObjectQueryParams& ObjectQueryParams)

In Start, you want to use : GetActorLocation() => Your actor location

In End, I imagine you would use this: GetActorLocation() + FVector(0.0f,0.0f,-1000.0f) => Your actor location minus 1000 unit downward.

You can declare “default” FCollisionQueryParams and FCollisionObjectQueryParams to pass here.

Hope this helps :slight_smile:

,

Thanks for the quick reply.

I can also use:

FindFloor
(
    const FVector & CapsuleLocation,
    FFindFloorResult & OutFloorResult,
    bool bZeroDelta,
    const FHitResult * DownwardSwee...
)

But that only returns a value if there is a WALKABLE floor below the character. I had thought of using a trace, but I am wanting to check more than just beneath the character. I am trying to develop a way to calculate the friction from ANY angle.

To elaborate:
I am trying to make a game where the character can slide down a tunnel (not unlike a bobsled race). Therefore, the character could be sliding on the ground, or the walls, or even potentially the ceiling. But I also wanted to check for multiple surface contacts in case the character is sliding in a narrow wedge and both the top an bottom (or both sides or whatever) are in contact with a surface at the same time. In a real world scenario, the friction from ALL contacted surfaces would be taken into account… not just one side.

So, I am trying to be able to calculate the TOTAL friction being applied from ALL sides. This is why I am using GetOverlappingActors. I tried doing OnActorHit events for this, but that is only triggered on first impact, not continually. I could do a trace, but in order to get enough contact surfaces to be useful, I would have to do at least eight of them every tick. I am afraid that this would be unnecessarily expensive.

If I could just get GetOverlappingActors to work with Landscapes, I would be golden. Unless anyone know of a better way to check for surfaces that are contacting the character (on a continuous basis).

Thanks again.

P.S. I am considering simply using a Static Mesh for the tunnel (especially since I can’t make a ceiling using Landscape)… But open-topped sliding areas might still exist. So, being able to get the Physical Material of the Landscape would still be very helpful.

Have you considered making a “sphere” trace with your character collision? This could return everything in collision with your character, including the landscape. You can also specify if you want the physical material or not. Here is the link to do that: