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"

SimpleMoveToLocation() doesn't work

I have to be honest, I copied this code from the TopDown project. But with my code it dowsn't work. Here is my code. AMyAIController.cpp:

             UNavigationSystem* const NavSys = world->GetNavigationSystem();
             float const Distance = FVector::Dist(destLocation, character->GetActorLocation());
             
             if (NavSys && (Distance > 120.0f))
             {
                 NavSys->SimpleMoveToLocation(this, destLocation);
                 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("condition is true")));
             }

The screen debug message is always displayed, so I think my problem is with the function SimpleMoveToLocation(). How can I make my character move to destLocation?

Product Version: UE 4.9
Tags:
more ▼

asked Oct 06 '15 at 12:24 AM in C++ Programming

avatar image

AleSpini
33 6 6 8

avatar image MieszkoZ STAFF Oct 06 '15 at 02:46 PM

Have you tried using VisualLogger to see what info gets logged, or tried to step into SimpleMoveToLocation? I recommend both.

--mieszko

avatar image AleSpini Oct 09 '15 at 05:54 PM

No, I have to learn how to use VisualLogger, I think I'll use this documentation:link text if you have any addictional documentation or tutorial please let me know! Thank you, I'll let you know if this solves my problem.

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

1 answer: sort voted first

It's ok, I made a huge mistake. I put a nav mesh on a map, but then I used another. Using SimpleMoveToLocation now it works! Sorry!

more ▼

answered Nov 06 '15 at 04:06 PM

avatar image

AleSpini
33 6 6 8

(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