Accessing blueprint components via other blueprints?

Hi!

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 the 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 the trick.

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

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

Thanks for your time and assistance.

Drag from Actor output of the 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 the trick. Thanks a bunch!

This fellow has a pretty detailed walk-through on the 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: http://i0.wp.com/www.tomlooman.com/wp-content/uploads/2014/06/getusableactor01.jpg

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 the line trace from my player. Currently it only registers the hit as the blueprint as a whole, and I can’t seem to figure out which static mesh component it was in the blueprint.

Thanks again.

Hmm…right now all i can think of is to make a sphere overlap components at the hitpoint of the trace and get the 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 the Components that are hit by the line trace, you can use Hit Component instead of Hit Actor from the Break Hit Result node.

Hope that helps!