Hey guys, I have this line trace you activate with the E key. It basically serves as a general purpose interaction (open door, pickup object, push button, pull switch… etc).
It simply traces a linetrace, hits an actor, and performs a different action depending on the hit actor.
Problem is: I do have to do this infinite row of “Is that this object? No? Is that other object? No? Is that other one? No?..” and so on and so forth until you get the right actor.
Now, this is ugly and huge and I am SURE there is a better way to do that.
Does anyone know how to do this in a smarter, better way?
Hey, thank you very much! I already knew interfaces and I used them for communication between characters and animations, but it never came to my mind they could be used this way!
Thank you a lot, this is really precious!
Could you provide an example? Not sure what you mean by adding a “function” to the “interface” that returns the variable. Wouldn’t you still need to cast to the certain character despite what it’s doing in its functions? Is there a node that makes a variable calllable everywhere inside of blueprints?
You can add a capability to the connection point that profits anything variable you are keen on, and afterward return that worth in every execution.
In any case, likewise, in the event that they are characters, you could have a baseclass that is normal to every one of your characters, that has the common factors in it.