Game Development Community

Problem with followPath

by CodingChris · in Torque Game Engine · 01/19/2007 (8:13 am) · 3 replies

Hi,
I use this resource(www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8836) and this is my code:
function CreateAIWheeledVehicle2(%client, %name, %block, %botPath, %spawnPoint)
{
	// Create the A.I. driven bot object...	
	%player = new AIWheeledVehicle2()
	{
		dataBlock = %block;
		path = %botPath;
		client = %client;
	};

	MissionCleanup.add( %player );
	%player.setShapeName( %name );
  
  %node = %botPath.getObject(0);  
  
  for(%i=0;%i<%botPath.getCount();%i++)
  {
	%node = %botPath.GetObject(%i);
	%player.addPathPoint(%node.getTransform(),%node.speed);	
  }
  
	%player.setTransform( %spawnPoint);
	
  %player.curentNode = 0;    // current node
  %player.setMoveTolerance(10.0);
  
  %player.score = 0;
 
    
	return %player;
}



function AIWheeledVehicle2::followPath( %this, %path, %node )
{
	echo("followPath()");
  // Start the bot following a path
  %this.stopThread(0);

   // Make sure our path is valid
  if( !isObject( %path ) )
  {
    echo( "AIWheeledVehicle::followPath failed - Bad Path!" );
    %this.path = "";
    return;
	}
	else
	{
		echo("Found valid path "@ %path);
	}

	%this.setStartNode(0);
	%this.init();
}
and now my problem is that sometimes the does not follow this path it drives off somewhere and sometimes it does not drive the curves correctly. I don't know why but sometimes all my bots are not working.
Hope for help

#1
01/19/2007 (8:50 am)
I know same with me.
#2
01/19/2007 (11:30 am)
I hope there's someone who knows how to fix that, it's not so comfortably to work on every track a few weeks to get it right working.
#3
01/21/2007 (3:05 am)
Is there no one who knows how to fix this?