x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
Tags:
more ▼

asked May 07 '15 at 02:04 AM in C++ Programming

avatar image

Brunke76
30 3 8 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 :

https://answers.unrealengine.com/questions/3446/how-would-i-use-line-trace-in-c.html

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 :)

Mick

more ▼

answered May 07 '15 at 03:24 AM

avatar image

MickD777
2.1k 70 37 259

avatar image Brunke76 May 07 '15 at 01:24 PM

Mick,

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.

avatar image MickD777 May 07 '15 at 02:31 PM

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:

https://answers.unrealengine.com/questions/130430/how-to-make-a-sphere-trace.html

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question