How to cast to blueprint from line trace.

How can I cast to the blueprint of the actor hit by a line trace?

You use “break hit result” and drag wire from “hit actor” output then you “cast to”. like


Brake hit result and from actor hit, cast to your bp. If you have different BP’s you want to hit then drag multiple lines of actor hit and cast to each BP. Hope that helps, im still noob myself, but I just figured this out recently.

When I drag out from the hit actor and type cast to which one do I select?
Should there be a casttohitactor or something like that?
I need it to work with any object that the line trace hits.

Do your object have there own BP’s?

There are 6 different blueprints that I need it to work with.
There are also more than one of each blueprint.

Yeah it would be easier if they had a cast to hit actor. So try drag off hit actor result, cast to node, then in the drop box select the BP of object. You can add a text variable to your object BP and get it after you cast to it, then print string for test purposes. You can add multiple cast to nodes to the actor hit output and it should just cast to whatever is is hitting, if that makes sense. EDIT: Wait sorry just cast to your BP when you do a cast, I was thinkin all actors of calss node.

There are different ways to proceed. First thing is to know if you can use a parent to have them as children. Because if you can, you’ll have to cast to parent only and then use a variable to determine which child if you need.
If you can’t parent them and there is no function, variable you need in your different bp, then using a tag will be enough.
If you need some variables / function from blueprint, then you’ll have to do a cast for each blueprint, using the fail output to test the next one and using exec one to do what you need with this blueprint.
You can store all your blueprints in an array too and check if blueprint is in with “contains” then use the index of the item to a switch with each output doing specific action of each blueprint.

Here is a link to tom looman’s usable actor system using linetrace, i learned a lot from it :