How to block collisions under mouse cursor?

I want objects placed in my level to block the click to move action, but I can’t set it up correctly.

I’ve made a “floors” object type and set only my floor as this object type, but the hit result traces through any other objects (such as this white cube) and returns my floor anyway.

how to block this?

1 Like

May or may not make a difference but you can try using blocking hit as the branch condition and on false, run the logic and on true do nothing. Make sure your static meshes are set to block for floors so it actually gets a blocking hit result.

The whole point of getting results under cursor for objects is to ignore everything else! You’re looking for floors, so it ignores everything else and gives you floor. You’ve set it up the other way round…

yeah I do realize that, but I want the opposite functionality so I’m not sure how to achieve it since the whole engine thing was set up to get a hit regardless.

is this achievable by trace channel? I tried messing up with it a bit but still nothing

Trace by Channel - basic visibility would work:

Providing the cube and floor block the Visibility channel, you’ll get hit from both but only if the cube does not obscure the floor. This, right?

right, but if I set my “move to location” to visibility rather than floors, then my character will move when I click -everything- that’s visible, and I want it to move only when I click on a floor, and not move if there’s any other object like a cube between the cursor and the floor

You need to filter it. Using tags is the most common solution and is built into every actor and component. You can have many tags and they’re inheritable:

4 Likes

I didn’t know about tags, this is a very simple solution and it works flawlessly! Thanks, I guess I just thought such functionality to block hits would be included in tracing.

Well, this works almost flawlessly. I had to add another branch before it for any hit results or it would return errors when clicking empty space

But it appears to work fine now, so thank you so much yet again!

1 Like

Yup, we can’t get a tag out of thin air! Also do note there is actor has tag and component has tag. Sometimes you may want a complex actor with just a few components that can be interacted with.

1 Like