Get overlapping components allways returning an empty list

I’m trying to make a building system for a game where you can pick up objects, and then place them down where you want them to be, and if the object is touching another object, it will be anchored in place and can’t move. When it comes to detecting if it is touching another object, it just doesn’t work for some reason and the get overlapping components function allways just returns an empty array.
Here is the code I have: (Also the code is in the first person character blueprint)
Code for when you pick up and put down stuff:


(Sorry about the really scuffed object collision changing thing, all I really care about right now is that it works and people can’t just prop-fly everywhere)
Here is the code that updates the position of the object that you are holding:

Activate draw debug type (recommend for one frame - there will be a red box if it hits anything), check trace complex to true. That way you can see what is being hit. There is also a Line trace for objects, try that one too.

I’m kinda new to unreal engine so can you give more explanation to that cuz I honestly have no idea what any of that means?

Hey just piping in to help out, @OJCAT_YT!

Here is what they meant:


You can set this to be visible so you can see what the traces are doing when you test!

For the second part, they were saying you can try “Line Trace For Objects” instead of “Line Trace By Channel” Depending on your needs. :slight_smile:
Hope this helps!

Thanks, I think i get it now, but I don’t think that will really help with the problem I have with the Get overlapping components not working because I know that everything else works (at least I think)

Try checking “get overlapping components” before you set them all to blocking.

Well, if everything is set to block, you need blocking, not overlapping. If you set everything to block, you should NEVER get any overlapping because… it’s not set to overlap. :slight_smile:

Now that I’m really looking at this it may be better to use a box collision or something and use the “OnComponentHit” Event.

Iv’e basically tried everything that I can think of, but when you say that I need to use “blocking” instead of “overlapping”, I cant find anything to do with the blocking thing. Using a box collision wouldn’t be the best for this because If you have a more complex object, I don’t want it so it detects if the bounding box is touching something, but instead I only want it to detect if an actual part of the mesh is touching something. Iv’e also tried the “OnComponentHit” event but I can’t figure out how to actually get it to work with what I’m trying to do. Is there any other possible sollutions if this way isn’t going to work?

Well, it sounds somewhat complex. It sounds like one of the primary mechanics of LoZ: Tears of the Kingdom. But other than that we really don’t know what it is you’re trying to do.

To clear up a question you had- When there is a collision block (not overlap) it can generate “On Component Hit” events- a hit is generated when two blocking colliders collide.

Hit:
{ }
only happens when two objects block each other- ignore beats overlap beats block.

Overlap:
[ { ] }

If you don’t know how to change the collision settings of a component- you select it in the hierarchy, then go to the details panel. In that panel there will be a “Collision” section and there you can set the component’s collision profile (what it is- is it a pawn, a static, a dynamic etc) and its collision reactions (vs pawn, static, dynamic, etc.)

Judging from what you have told us you NEVER want to overlap because when they collide they would fuse, correct?

Ok, so I’m trying to recreate the building system in the roblox scp3008 game. Here is a video better explaining what I’m trying to do:

Hi @OJCAT_YT,

I had a similar issue before, so I want to make sure that this isn’t the cause.

Make sure that “Generate Overlap Events” is checked not just for the mesh being moved, but also any static meshes you want it to collide with. This is off by default on all static meshes.

OHKAY I understand so much more now.

If these objects would fall due to physics that adds some complexity but let’s assume no physics first so things don’t fail, then add physics after the base mechanic is built.

On grab, you’ll want to set collisions to Ignore. You’ll want to use tick to actively set the location using a “Line Trace By Channel” node from camera center TO GetComponentForward x Distance(so it doesn’t go off into the distance where there isn’t an object/floor).

I haven’t tried this before, but what happens if you simply don’t re-enable physics when you let go? If you’re constantly setting the location, it should stay where it is when you let go. Is the problem here that you ONLY want it to stick if it’s overlapping another Static mesh and that’s the specific problem?

If so, set the MESH collisions to Overlap vs World Static (and World Dynamic if necessary) when you pick it up, leaving the rest as ignore (this is important to prevent the player using themselves as a sticky point).
As the fantastic @sarahlenker said, make sure the “Generate Overlap Events” box is checked on the static mesh. I don’t think you’ll NEED it for this method, but if you’re using overlap moving forward you probably will at some point.

When you let go, you can then do a “GetOverlappingComponents”, check if the first index is valid (meaning, there is at least 1 static mesh it’s overlapping with). On TRUE just leave it there.
On FALSE, Re-enable physics so it can fall.

Give this stuff a try and let us know your results!

Thanks! I ended up just enabling “Generate Overlap Events” on everything and it works!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.