Strange behavior with UNavigationSystem and recast / detour

Hello again everyone!

I’m super excited that the detour was included in the 4.3 update!
I have been experimenting a bit with it the last week, but I’m unable to get it to work properly, so I thought I’d run through my problems and what I’ve tried here and hope that someone might have some insight on what I’m doing wrong.

I currently have a scene where I have several agents that all have controllers deriving from AAIController. As recommended, to make them use recast and detour, my constructor for these subclasses’ constructors look like this:



    ACharacterAIControllerBase::ACharacterAIControllerBase(const class FPostConstructInitializeProperties& PCIP)
    	: Super(PCIP.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
    {
    }


In my subclass of ACharacter I then try to invoke the navsystem like before, doing something like this:



	UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
	float const Distance = FVector::Dist(Destination, GetActorLocation());
	if (NavSys && (Distance > MoveDistanceDeadZoneRadius))
	{
		NavSys->SimpleMoveToLocation(Controller, ActualDestination);
	}


This seems to be working-ish. They follow the generated navmesh well (They walk around static meshes etc.) but if I try to:

  1. Order a character to move to the other side of another character that is standing still, the ordered character will first start rotating back and forth a bit, and then literally fly away!
  2. I try to move several characters at the same time, they sometimes seem to move correctly if their paths do not collide, but if they happen to get to close to each other, they stick together and again, fly away.

Since this also happens in case (1) above, I have to assume this is at least not purely a problem with the physics like I first assumed (I was guessing at some collision-repelling that was going horribly wrong).

My current guess is that I need to do something other than NavSys->SimpleMoveToLocation(Controller, ActualDestination); to invoke the recast navigation as the first thing. But I’m also a bit worried about the characters flying away, that to me indicates that I have misconfigured the physics somehow? I’ve put a link to a youtube video that illustrates the two situations so you guys can have a look :slight_smile:

Best regards,
Temaran

I keep going over the API myself on this, and my guess is it could have something to do with the requestMoveTarget() vs simplemove…but, I couldn’t say for sure. Still trying to wrap my head around this myself.

I know 4.3 is new and many are still getting familiar with the new feature, but if anyone has some experience setting this up during the preview or earlier github builds, I’d love to see some more documentation on the wiki or from Epic.

Hello!

Yeah, I thought so too first, but there does not seem to be a more sensible function, looking at the function implementations themselves also, it seems like the SimpleMove actually does tie into the recast lib if the proper compilation flag is set, which it is.

Do you have the same problem I have with the characters “flying away”? or is that unique to my setup?

I’ve tried fiddling around with the movement component of my actors as well to maybe try and limit the strangeness that ensues, but to no avail I’m afraid. My biggest question right now is basically if this is a programming error on my part, if it’s some bad config in the editor, or if it is just a glitch that will resolve itself as that subsystem becomes more mature.

I’ve been trying to play around with some other stuff in the engine the last week, but I thought I’d have another go at this this evening :slight_smile:

/Temaran

Just an FYI on my progress if you are still struggling. I started a new project, did nothing except for setting UCrowdFollowingComponent in AIController, dropped a bunch of characters using said AIController into the scene, then set them to follow “MyCharacter” on tick in blueprint using simple move to actor. Could not reproduce the bugs you see, except my characters lose rotation while following which comes back properly after switching back to UPathFollowingComponent.

Not much help I know, but hoping to provide at least a little feedback.

Hello again!

Any feedback is greatly appreciated. I’m going to try and repeat your test later this week if I don’t figure anything else out. There are subtle differences in your situation and mine though that might provide insight into my problem. By the way, which commit are you running on? Two things that stand out to me is

  1. I have custom AI controller components and character classes. Might be something there.
  2. I don’t issue one move command and have the others follow, I instead issue a move command to one to several characters at the same time. I don’t think this should affect anything though since I’ve tested trying to issue a move command to a single agent to make him move around a stationary agent (as can be seen at the start of my video).
  3. I don’t have any problems with rotation, I think your problems with that stem from the “follow” instruction when the system tries to correct for being to close probably.

/Temaran

Yeah, most likely the rotation thing is just due to throwing stuff together real quick. I’m using 4.3 and don’t touch the source. For various reasons.

Keep an eye on this thread in case something pops up on it. There should be some player type AI templates - Feedback & Requests - Epic Developer Community Forums
Possibly we might see something from on detour crowds.

Cool! Thanks for the info!

I tried repeating your test, and I get the same results, so it has to be something in my project that gives rise to the problem (not altogether strange I guess ;))
Anyways, I’m going to mess around with some more properties and get back as soon as I know anything else.

/Temaran