how can I possess a pawn that I hit with a line trace?
I want to have mulitple characters that can be possessed all under the third person character parent class. But when I try to possess I can’t figure out how to get the pawn reference from the hit actor.
The Out Hit Actor probably needs to be casted. So drag a “Cast To ThridPersonCharacter” node from Out Hit Actor. Then from that cast you can call Possess!
That should work, please let me know if it does not.
Make sure the object you want to hit with the line trace blocks the line trace channel you are tracing in. For example if you are line tracing the visibility channel, all things that are blocking the line trace visibility channel will get hit! I suggest you make a custom Linetrace channel in the project settings that only the ThirdPersonCharacter class will block. Here you can read up about custom Trace Channels
My guess is that your line trace hits something other then the ThirdPersonCharacter before it hits the ThirdPersonCharacter. Make sure you have ignoreSelfActor set to true.