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"

Unable to correctly get a reference to an actor

Hi all, so I'm attempting to get a reference to three actors, (each has their own object reference variable) and thus get their location.

However when the print node prints their individual locations, all three of them print (0,0,0). This leads me to believe that I'm referencing it wrong. This is my simple script: alt text

As I said, the print string prints (0,0,0) so I'm referencing it wrong.

A bit more info:

  • The actors ( I'm trying to get their location) are spawned after the player starts playing the game, rather: throughout it.

  • This actor (their BP is shown right here) is created after all three of the other actors are created

Here is my variable defaults/settings for the object reference variable alt text

Thanks a lot!

Product Version: Not Selected
capture.png (169.9 kB)
capture2.png (44.1 kB)
more ▼

asked Dec 28 '14 at 04:47 PM in Blueprint Scripting

avatar image

444 99 84 108

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

1 answer: sort voted first

Well where do you reference them?

You want to water your flowers (-> get the vector) but right now you have an empty bucket (-> a variable) and try to water your flowers with it (-> get the vector from an empty variable)

You either have to store those variables somewhere else and let the actors save the reference there themselfs (which doesn't work here because it hasn't spawned when the actors are created) or you can use "Get All Actors of Class" if there is only one of each actor at any given time. This will provide you with an array. Since you always only have one just get 0 and use that instead of the variable.

I hope this helps.


more ▼

answered Dec 28 '14 at 04:56 PM

avatar image

5.9k 291 86 293

avatar image ShrewGlue Dec 28 '14 at 05:24 PM

Thank you! This is perfect. For some reason though my triangle seems to be offset: alt text

Do you think you can help me figure out why this is?

Here is my short blueprint script: alt text

capture.png (451.7 kB)
capture.png (237.7 kB)
avatar image Erasio Dec 28 '14 at 05:43 PM

Sorry. I got no engine nearby (and by that I mean I have no computer available on which I can run it or which has a good enough internet connection to download it within the next few days) and never worked with mesh generation so far so I don't know where your code goes wrong.

Have you tried placing it manually into the spot (simulate and then change the location and rotation) to see if it has the correct size. Maybe your mesh component is a bit off or the generator only generates a mesh but not with the exact location (after all you only provide a triangle and not the locations anymore).

Just random guesses though. As I said. I never worked with this so far.


avatar image ShrewGlue Dec 28 '14 at 05:50 PM

I've fixed it. Turns out that I was offsetting it slightly by having weird numbers in the spawn transform. Many thanks for your help! Really appreciate it :D

(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