Jump to content

Pathfinding


photo

Recommended Posts

Hi Guys,

 

i played today a little bit with the sample "route_00". I reduce the number of bots to one, to see who all work.

But now I have a Problem which I dont understand.

 

In this case all works great, but...

 

if(engine.game.isEnabled()) {
     	myCoin.update();
         robot.update((1));
         if(robot .needCoin() == 0)
     	{
  		robot.createCoin(engine.game.getRandom(min,max));
		}
}

 

if(engine.game.isEnabled()) {
     	myCoin.update();
         robot .update((1));
         if(robot .needCoin() == 0)
     	{
  		robot.createCoin(pos1);
		}
}

void create_scene() {

   NavigationSector navigation = add_editor(new NavigationSector(vec3(1024.0f,1024.0f,9.0f)));
   navigation.setWorldTransform(translate(Vec3(0.0f,0.0f,5.0f) + offset));
pos1 = engine.game.getRandom(min,max);
robot  =new Robot2D(engine.game.getRandom(min,max));
   return "PathRoute2D in NavigationSector with obstacles";
}

 

in this case the robot stands still by his first and last coin, why? I dont understand it, and i tryed several things.

Link to comment

My mistake was that havent understand the function - calling there :). Now i change it in this way, that I have a vec3 array in my robot class, in which i can add new Waypoints.

And by the function-calling

robot.createCoin();

I call my array-index. So it works. So there is no Bug ;)

Link to comment
×
×
  • Create New...