Download

Navmesh and pawns

Hi,

I m just trying to prototype some basic UI responses and want to use a pawn instead of character (don’t want to deal with skeleton mesh and such , plus I will be using a completely different skeleton eventually anyway). But when it gets to FollowingComponent it calls IsPathFollowingAllowed and that returns false because it does the following:

MovementComp && MovementComp->CanStartPathFollowing();

and pawn’s MovementComp is NULL.

Tried to add it via AddComponent but doesn’t show up there.

Any idea what the best way would be to enable pawn so it can participate in navmesh.

Not sure it can right now. At least there was a thing on the development trello to fix it so that anything can have those components, so I suspect its tied to characters currently. Probably a reasonably easy fix though, so if you do it, be sure to submit a pull request (which I think is a daft name for it but whatever :))

Well, so far I got over that part by creating a pawn subclass I called NavmeshPawn and adding the following in .h :

UPROPERTY()
UFloatingPawnMovement* Pawnmovement;

Then in constructor of that pawn

Pawnmovement = CreateDefaultSubobject<UFloatingPawnMovement>(TEXT(“movement component”));
Pawnmovement->UpdatedComponent = RootComponent;

That fixes my original issue.

But now recast’s findNearestPoly returns invalid ref for start poly so looking at that now…

Ok, so invalid poly ref was coz of some mesh messup I had, so as it deducted base height from agent location it ended up being outside of the navmesh bounds.

So… yeah - to get pawn to use navmesh it looks like all it needs to be done is to add that floatingpawnmovement component I did above.

Now the issue I m dealing with is that my pawn is superfast. It reaches the location almost instantly. (but if I really pay attention i can see it avoiding objects during it’s superfast move). Havent’ figured that one out yet - and I did set those acceleration/speed values on pawnmovement component to very low values. Even zero. But it still moves very fast.