Edit:
Code:
if(Ais.elms())
{
FREPAD(i, Ais)
{
ai.New().createAI(iAi++,Ais[i].obj.findParam("Name").asText(), Vec(Ais[i].pos().x, Ais[i].pos().y+112, Ais[i].pos().z), Ais[i].obj.findParam("radiusMove").asFlt(), Ais[i].obj, Ais[i].obj.findParam("agressive").asBool(), Ais[i].obj.findParam("radiusRange").asInt(), Ais[i].obj.findParam("health").asFlt(), Ais[i].obj.findParam("mana").asFlt()); //ID(326913368, 1079849300, 1809609151, 1190028286)
Memc<Vec> pa;
if(Game.World.path().find(Vec(0, -112, 0), Vec(2, -112, 2), pa)){
Gui.msgBox(S, S+"ok");
}else
{
Gui.msgBox(S, S+"not ok");
}
}
}
It's work when i put Vec(0, -112, 0), Vec(2, -112, 2), because at my y=0 between editorworld and world in code there is a difference of nearly 112.. but it's just work in my World.cpp so i can imagine that my PathWorld is delete somewhere maybe
Thank for reply!
so with your advices, i search now how can i get the pathworld on server, I look how the tutorial 08 - Pathfinding process, and they did this:
Code:
Game.ObjMap<Game.Chr> Chrs;
Game.World.activeRange(D.viewRange())
.setObjType (Chrs, OBJ_CHR)
.New (UID(3199326727, 1331546700, 2335466931, 1420158981)) // load "path" world
.update (Cam.at);
My World.cpp on server is like:
Code:
Net.World &world = *Net.Worlds(world_id);
Game.ObjMap<CustomStatic> Decors;
Game.ObjMap<CustomStatic> iTrees;
Game.ObjMap<CustomStatic> movingtrees;
Game.ObjMap<CustomStatic> Ais;
//Game.ObjMap<Item> Items;
// Memx<movingtree> ObjInMotion;
// Game.ObjMap<CustomItem> Item;
Game.World.mode(Game.WORLD_MANUAL);
Game.World.setObjType(Decors, OBJ_STATIC)
.setObjType(iTrees, OBJ_TREE)
//.setObjType (Items , AG_TERRAIN)
//.setObjType(Item, OBJ_ITEM)
.setObjType(movingtrees, OBJ_MOVINGTREES)
.setObjType(Ais, OBJ_CHR)
.New(EditorWorld);
My Ai are loaded like this:
Code:
if(Ais.elms())
{
FREPAD(i, Ais)
{
ai.New().createAI(iAi++,Ais[i].obj.findParam("Name").asText(), Vec(Ais[i].pos().x, Ais[i].pos().y+112, Ais[i].pos().z), Ais[i].obj.findParam("radiusMove").asFlt(), Ais[i].obj, Ais[i].obj.findParam("agressive").asBool(), Ais[i].obj.findParam("radiusRange").asInt(), Ais[i].obj.findParam("health").asFlt(), Ais[i].obj.findParam("mana").asFlt()); //ID(326913368, 1079849300, 1809609151, 1190028286)
}
}
CustomStatic is:
Code:
class CustomStatic : Game :: Static
{
Game.ObjParams obj;
//PhysBodyPtr phys; // fixme
void create(Game.ObjParams &obj)
{
super.create(obj);
T.obj = obj;
}
C UID get_ID()
{
if (&obj)
return obj.base().id();
return UIDZero;
}
~CustomStatic()
{
obj.del();
}
CustomStatic(){};
}
Now on Main server something like this:
Code:
Memc<Vec> pa;
Game.World.path().find(Vec(0, 0, 0), Vec(2, 2, 2), pa)
is always false instead of calculate the good path so there is an issue for this ? I'm actualy seeking why it's always false.