Hello there fellas
I’m trying to implement a way for me to have three types of objects (Interactive, Inventory and Pickups). Normally I code but I haven’t learned how to C++ yet so I’m going with Blueprint.
What I’d do is I’d have these three be abstract classes, perhaps implementing interfaces with functions in them so that I can call this easily.
Then my idea is that first I use a line trace to check if there is one of the three types of objects. If there is I take the necessary action that you can do to that item if any.
This is where my problem arise. I don’t know how to do this without it being very tedious to implement. Here is a scenario I’d like to have:
- Do a Line Trace
- Figure out if any of the three types of objects are hit by the line trace.
- In this example lets say it’s an interactive item.
- I cast the actor reference to an InteractableObject.
- ???
- Call the RunInteraction() function that is specific to that type of interactable item (like a lever will be different from a door)
- The interaction plays out.
How would I achieve this workflow with blueprints? I can’t really figure out how to do this without casting the item I find to a door but then I’d have to find out first if I have the right door and that can only be achieved by doing excessive cast tries and that can be quite infeasible to do if you have a lot of different intractable items.