Hey there,
i’m actually writing my bachelorthesis about pathfinding optimisation for stacker control systems and I’m working on a demo for it now.
Your scripts are working great but I’m actually stuck. I am using your AIPath for my seeker. All I want to do is, to choose a random target of a number of targets where he goes to. After arriving the target he shall search for a next random target.
I just tried to configure the SearchPath() method.
This is my code so far:
`
/** Private Float for Random Numbers */
private float randomNumber;
public List<GameObject> Children;
public virtual void SearchPath () {
GameObject container = GameObject.FindGameObjectWithTag("Ziel");
if (target == null) throw new System.InvalidOperationException("Target is null");
lastRepath = Time.time;
//Creating a List with gameobjects of tag "Ziel"
foreach (Transform child in transform)
{
if (child.tag.Equals("Ziel"))
{
Children.Add(child.gameObject);
}
}
//Getting the size of the list
int sizeOfList = Children.Count;
for (int i = 0; i <= 4; i++)
{
randomNumber = Random.Range(1, sizeOfList);
int tempValue = (int)randomNumber;
target = Children[i].transform;
//This is where we should search to
Vector3 targetPosition = target.position;
canSearchAgain = false;
//Alternative way of requesting the path
//ABPath p = ABPath.Construct (GetFeetPosition(),targetPoint,null);
//seeker.StartPath (p);
//We should search from the current position
seeker.StartPath(GetFeetPosition(), targetPosition);
}
}`
Does the AIPath script work for random targets or do I have to write my own simple script?
Cheers