Pathfinding for entities placed in editor.

So, I am going through pathfinding code from Pathfinder template just to learn and see how that works. I can't understand one bit.
In original template your character is spawned when you join the game, normally the map is empty. I understand that. I created function that spawns the same AI entity wherever I want, and it works, I can take control over it and tell it to go somewhere (inside the Nav mesh). Great. The problem appears when I drop this entity in the editor, save and export the level, the entity doesn't react for pathfinding actions.
I found that

Code: Select all


fires, position is passed properly etc.
The callback function RequestPathTo is not being fired. I don't know how can I find the reason. Any ideas?

Re: Pathfinding for entities placed in editor.

Yeah I checked all cvars to debug this, everything seems to be alright. Also console does not print anything. It is exact the same entity, using exactly same code. The only difference is that the working one is spawned on the run using

Code: Select all

pEntitySystem->SpawnEntity ();

And the one that fails on pathfinding is spawned in GameRules.cpp and It originally uses

Code: Select all

pActorSystem->CreateActor ();

Re: Pathfinding for entities placed in editor.

is code from the link?

Actor is kind of entity , that is networking releated, local player or remote player or Ai.

i search



CManagedActor::Init(IGameObject* pGameObject)

if (!pGameObject->BindToNetwork())
return false;

gEnv->pGameFramework->GetIActorSystem()->AddActor(GetEntityId(), this);
return true;

try change your class to inherent from CManagedActor ; may be wrong.


and paste your log and code . may be help to solve your issue.

Re: Pathfinding for entities placed in editor.

I can't find CManagedActor class anywhere. It's nowhere in IActorSystem.h or ActorSystem.h.

This is very weird issue. My code must be fine, since the entity follows the path when spawned on the run. I tried to change GameRules.h method where the Actor is spawned. I changed that to the same code I use when I spawn on the run, but it doesn't change anything.

Figured out!!
Inside ProcessEvent method of my actor I placed this code:

Code: Select all


Basically what it does is I guess initialization of the AI properties and methods, callbacks etc. once again. Even though it is being called on spawn of my actor, it still needs to be done on reset event. Thanks!

Who is online

Users browsing this forum: No registered users and 1 guest