Set line trace to target mesh of another blueprint

I’m working on a desk blueprint for my horror game, where the player can open all four drawers on the desk and close them. I’m not having a problem with the opening and closing, just how it’s targeted. As of right now, the character blueprint targets the entire model of the desk when all I want it to target is the top drawer.

DeskBP

CharacterBP

Desk Image

The desk and drawers have been created separately, so for example the top drawer is called top drawer so if possible, I’d like to change my line trace to only target the top drawer instead of the whole desk object.

Try to give the 4 drawers an BP Interface:
ss+(2016-06-14+at+06.36.49).png

And the call looks like this that:

So you can prevent that the trace catch the desk.

Sorry for the late reply, not touched Unreal since I posted this thread. I can’t seem to find the items listed in the details screenshot you’ve provided, where would I find this?

Edit
Found out how to do it, seeing if I can get it working now

Edit 2
Attempted to do this, but it’s not quite working and I don’t think I’m understanding what I’m doing. I’ll post screenshots below of what I’ve done, but as of right now, the desk drawers still open regardless of where the player clicks.

Anyone know how to resolve this?

Instead of testing HitActor, grab HitComponent and check if it == TopBox (or more likely, one of it’s collision boxes).
Doing this you should be able to figure out which drawer you hit, and send the execution to that specific drawer (or to the desk, telling it which drawer was hit).

You might need to use a multi line trace if the desk collision will get in the way.
But then the line trace might also go through to drawers underneath as well, so you’ll need to figure out how to handle that (probably just grab the first drawer component that was hit, from the trace array)

Do you need the vehicle collision channel? If not, I have a easy way without too much setup.

  1. Replace your “line trace by channel” with “line trace for objects”. This will get you options, what collision channels to check. The line trace works exactly as your line trace just with collision channels instead of using the visibility collision channel.
  2. Just drag out from the “object types” pin and then click on “Make array”. Select “Vehicle” in the array and that’s it. Now just go to your top drawer collision box in the viewport and change your collision to “vehicle”.

Sorry for late reply, but this has solved my problem, thank you very much :slight_smile:

Glad to be of help. Have fun with your project :).