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"

Actor don't move after spawn

Hi everyone! I spawn a unit from blueprint, and make him a move to location from c++. I'm using SimpleMoveToLocation when my unit BeginPlay. But after spawn my unit stend on started location (in Log my scripts started).

That strange, but If I place unit to scene (from editor) he move to target correctly.

I have no idea what I'm doing wrong...

Product Version: UE 4.12
more ▼

asked Sep 19 '16 at 07:52 PM in Blueprint Scripting

avatar image

147 6 7 9

avatar image Shiggi Sep 20 '16 at 08:47 AM

That my code:

 void AUnitController::MoveUnitTo(FVector Target)
     UE_LOG(LogTemp, Warning, TEXT("Start MoveUnitTo"));
     APawn* const Pawn = GetPawn();
     if (Pawn)
         UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
         UE_LOG(LogTemp, Warning, TEXT("Pawn is %s"), *Pawn->GetName());
         UE_LOG(LogTemp, Warning, TEXT("Target location %s"), *Target.ToString());
         NavSys->SimpleMoveToLocation(this, Target);


 LogTemp:Warning: GameUnit_C_0 - move to target
 LogTemp:Warning: Start MoveUnitTo
 LogTemp:Warning: Pawn is GameUnit_C_0
 LogTemp:Warning: Target location X=40.000 Y=70.000 Z=10.000

Pawn settings:

alt text alt text

FloatingPawnMovement settings:

alt text

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

1 answer: sort voted first

Problem solwed! I spawn jast a pawn... after need spawn controller and posses them to actor. Or use SpawnAIFromClass...

more ▼

answered Sep 20 '16 at 02:04 PM

avatar image

147 6 7 9

(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