x

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"

[BUG] Get Actor Location fails for Child Actors

Hello!

In 4.7.2, and presumably in previous versions you cannot get the location of an actor that is used by a Child Actor Component, it will always return a zero vector. I assume this is something to do with the inline function using the root component location, but child actors doing something funky with the root component?

Thanks,

Luke

Product Version: Not Selected
Tags:
more ▼

asked Mar 18 '15 at 03:50 PM in Bug Reports

avatar image

ambershee
603 23 30 52

avatar image Ben Halliday STAFF Mar 18 '15 at 11:57 PM

Hi ambershee,

I'm not certain I understand. Is Get World Location for the ChildActor component returning a zero vector? This works for me:

alt text

I tried that with the Child Actor as the root component as well as a sub to a Scene component. Are you setting this up differently? I checked this in 4.7.3, but I don't recall having an issue with it in 4.7.2 either.

avatar image ambershee Mar 19 '15 at 01:18 AM

My code used to check it looks like this:

         for (TActorIterator<AScrollingPlayerStart> It(World); It; ++It)
         {
             AScrollingPlayerStart* Start = *It;
 
             FVector LOC;
             LOC = Start->GetActorLocation();



My setup is simple - I have a camera actor with a child actor component, and the Scrolling Player Start is the child actor. I noticed that the actor I was trying to spawn was being spawned at the origin, every time without fail - so I added that line to check the location. In the editor, the I could see the child actor where I expected it, but the actor supposedly spawned at it's location was at the origin.

Whilst debugging, LOC always gets a zero vector - it finds the child actor just fine, but fails to get the location every time.

avatar image ambershee Mar 19 '15 at 01:24 PM

I tracked down the cause of the behaviour - a natively created subclass of actor does not have a scene component by default, whereas a blueprint created one does. Since it didn't have a scene component, it could not correctly get the location of the actor.

I do feel this is a bit inconsistent though. It doesn't feel right that a native version of a subclass should behave differently to a blueprint created one.

avatar image Doug E ♦♦ STAFF Mar 19 '15 at 09:21 PM

Hey ambershee-

Are you referring to the location of the child component in world space or the location relative to the parent location?

I created a child actor component and then use:

FVector ComponentLocation = ChildComponent->GetComponentLocation();

I was then able to print to the screen the x, y, and z value of the vector to show the world location of the component.

Cheers

Doug Wilson

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

1 answer: sort voted first

Hi ambershee,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

more ▼

answered Mar 25 '15 at 07:47 PM

(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