Accessing blueprint components via other blueprints?


In my project, I have several drawers and cabinets that are constructed with blueprints, and each of them has varying loot spawning in them. Since interactable objects are so densly positioned, I can’t really use trigger volumes to open said cabinets and drawers, so I’ll have to most likely rely on line traces to do trick.

Now, my problem with this is that I can’t figure out how to communicate line trace hit across to cabinet blueprint. I basically need to know which drawer(component, in another blueprint) line trace actually hit.

My initial plan was to have line trace originate from Character blueprint (which it currently does), and have it interact with other blueprints placed around scene.

Thanks for your time and assistance.

Drag from Actor output of Hit Result and then Cast to your drawer BP. Then you’ll be able to get every component that BP has via that cast node.

That’ll do trick. Thanks a bunch!

This fellow has a pretty detailed walk-through on whole “inventory” intractable thing using a Line Trace. Might help. Basic Inventory System in Blueprint - Tom Looman

Here is a link to his trace setup that works for me:

hope this helps you!

Jacky & Gabriel, thanks, both of you were super helpful.

But I still have an ongoing problem. What I specifically need to achieve here, is to figure out which component was hit with line trace from my player. Currently it only registers hit as blueprint as a whole, and I can’t seem to figure out which static mesh component it was in blueprint.

Thanks again.

Hmm…right now all i can think of is to make a sphere overlap components at hitpoint of trace and get drawer component it overlaps. I’ll let you know if i can think of a less hacky way.

Hey Niuva,

If you’re looking for just Components that are hit by line trace, you can use Hit Component instead of Hit Actor from Break Hit Result node.

Hope that helps!