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"

When spawning a c++ Actor from blueprint, why is the GetOwner and GetInstigator null?

I have recently began the journey of learning the c++ ways, and am converting my various knowledge of blueprints into c++.

My current 'Non Homing Projectile' is simple. It is meant to be a spawn and travel in the direction that the controller is facing in. Currently in Blueprint, I can simply grab the owner, cast to pawn, and then set the current actor rotation based on getting the controller of the owner: http://puu.sh/pGkrD/079d5b6257.png

I attempted to add the code in c++ to replace the current Blueprint version of this functionality, but the GetOwner and GetInstigator functions both return null as far as I can tell as the only message that prints off is 'My Rotation is Null =(": http://puu.sh/pGkAB/771e01f07b.png

How I am spawning the projectile: http://puu.sh/pGkCF/efb857b1c5.png

Summary: My Blueprint variation of setting the ActorRotation based on the Owner works, but the c++ version does not know of an owner. So is this a product of spawning an actor in blueprints? Or is this a case of c++ constructors firing earlier than I am expecting (this works when I move the code to BeginPlay in c++ of course, but projectile movement being set on construction is what I want). Any help or tips would be appreciated!

Product Version: UE 4.11
more ▼

asked Jun 26 '16 at 06:09 AM in C++ Programming

avatar image

136 6 7 11

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

1 answer: sort voted first

Same problem on 4.18

more ▼

answered Feb 14 '18 at 04:55 PM

avatar image

96 7 19 21

(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