Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to possess hit actor

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.

Pics: https://docs.google.com/document/d/1DJ20783P5svjiQviuLSc1ttJVsaG4uZVJ88uzddCNC4/edit?usp=sharing

Product Version: UE 4.15
more ▼

asked Oct 25 '18 at 08:43 PM in Blueprint Scripting

avatar image

5 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hello! You should normally be able to do the following

  1. Cast the out hit actor to ThirdPersonCharacter (do not get the the class but cast it to the Blueprint) using the following node : alt text

  2. On success then get your controller and call posses pawn on it like so:alt text

Hope this solves your problem! If it doesn't work let me know

Happy coding!

fqsfqsf.png (21.2 kB)
fqsfqsf2.png (62.7 kB)
more ▼

answered Oct 25 '18 at 09:15 PM

avatar image

43 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users


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.


more ▼

answered Oct 25 '18 at 09:12 PM

avatar image

408 7 7 10

avatar image LightPS Apr 16 '19 at 11:01 AM

I tried it it but cast is getting failed!

avatar image ThompsonN13 Apr 16 '19 at 01:37 PM

if your cast is failing then the object in doesnt inherit from class your casting to. put simply you arent hitting a thirdpersoncharacter.

avatar image LightPS Apr 16 '19 at 02:52 PM

How can I solve it? I wanna posses a Character(ThirdPersonCharacter) through a line trace which I set up in a Pawn Blueprint.

avatar image PurrPaw Apr 16 '19 at 05:39 PM

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.

avatar image LightPS Apr 16 '19 at 06:16 PM

Thanks man! It worked.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question