Since a week, I don’t know how to find the “pawn” who is touched by my vector.
What I want is that when my object is aimed (touched by my vector) I posess the “pawn” aimed by my vector and not automatically “Pawn Banc”
On the image for example if I could connect “Hit Actor” to “In pawn” that would be perfect.
Drag the pin from Hit Actor and search for Cast to Pawn node, this will do a conversion for you, make sure to attach Cast success to execution pin of Possess. If Hit Actor was not Pawn, casting will fail and out variable will be null.
There must be some documentation on Blueprint casts.
Basically, what it does, is simply converts reference to one type, to reference to another type.
Conversion works both ways, from Pawn to Actor, and from Actor to Pawn, pawn and actor are here only for example, it works for every type, if they’re in the same hierarchy. So if you’re trying to cast PlayerController to Pawn, it will fail, but if you try to cast PlayerController to Actor, it will success.
Hi, thanks for the answer, i’m gonna test this tommorow on my computer. I will put a blueprint if it works proprely.
Thanks for your advices. Ok so I’ve tried this and I dont know why, the cast fails systematically. Ive upload two images, first one is the blueprint done on your advice, second one is the blueprint that is “supposed” to be a pawn that I whant to possess when I look at it.
You perform multi-line trace but take only first element of out array, are you sure this element is exactly what you need? Make sure you actually hit your pawn with the trace.
Since it’s a level blueprint, try to directly reference your pawn in the blueprint and possess it.
P.S. I don’t see need for multi-line trace here actually.
Ho, I see what is going wrong. The cast works proprely thanks to you (I replace it with a single-line trace)
But it dosent work when I plug the blueprint “set view target with blend” Why ? The pawn is still the same so why does the cast fails ?
Solved the problem, for whatever reason, unreal need a delay of 0 sec for casting proprely, here is the final blueprint if somoene need an answer on the same question.