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"

GetWorldLocation in construction script return 0,0,0 for components

Hello, i don't know if this is a bug or if it's normal but if i use GetWorldLocation or GetRelativeLocation in a construction script in within a BP owning this component, the result will always be the default location of the component in the BP, not the values that was modified in an instance of this BP in the level. If i call this from an other actor then the values are corrects. It seam that at construction script time locations of components are not set yet.

Product Version: UE 4.20
more ▼

asked Aug 11 '18 at 01:45 PM in Blueprint Scripting

avatar image

1 1 2

avatar image mightyenigma Aug 13 '18 at 04:19 AM

do they have different values if you check them a few seconds after they are constructed?

avatar image ElFab Oct 02 '18 at 02:33 PM

Sorry i didn't see your comment. :) This is the problem, i think yes but how can we "check a few seconds later"?? It was my first idea, to add a delay after the "construction script" node but it does nothing at all (and i think it's normal, delay is a runtime thing).

avatar image mightyenigma Oct 02 '18 at 05:24 PM

Maybe try the BeginPlay event, since that fires after the constructor AND after the object has finished being spawned into the world ( at least I think it does ). Maybe you won't even need a delay

avatar image ElFab Oct 02 '18 at 06:42 PM

At runtime it's ok, the problem is in the editor (construction script), currently i have this configuration : - Top down style but with fixed camera positions, a lot's of them because it's a 3D mobile game and camera is an important part of my gameplay. - for help me to place all these cameras, i use one "target" per camera, the camera look at the target. It is working, if a select the camera, use the pinlock in the camera view and select my target actor, i have what i want : be able to move the target while looking through the camera.

But at some place i have 3 or more of them very close and when i need to adjust, i need to found who is with who (group is nice but borring, need to ungroup for adjust etc, i currently just parent them and it's not perfect).

That i wanted was to be able to have just one blueprint with my camera component and my target component and then, have 2 times less actor to add/sort/link...etc. And something nice is that when you click on an actor, if it contain a camera, the camera view is enable and you have a shortcut to move it (even if you don't select the camera component itself). So for me that should realy be a big help, i select the actor, move the camera where it should be, select the "target" component and move it to adjust the camera view. It's why i need that to work in Editor. I don't need it at runtime. But yes at runtime that work (if i remember good).

As you see It's not a realy big problem i can work without that but for this question i was wondering if it's normal or if it's a bug, or even if this is my fault (a setting somewhere that implies this behavior). Thank you for your interest.

avatar image mightyenigma Oct 02 '18 at 09:00 PM

That makes a very big difference. Sorry I assumed it was a runtime not editor thing. I wonder if it's something as simple as needing to call the parent constructor before querying the location?

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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