SpawnOnPath help with multiple paths needed
by Infinitum3D · in Torque Game Engine · 06/24/2008 (10:14 am) · 2 replies
I'm tryint to get my rat to follow a path. I've done the aiRat::spawnOnPath' followPath, moveToNode, and moveToNextNode functions. My aiRat spawns on the path, but doesn't move unless I add the ::onReachDestination, onEndOfPath, and onEndSequence functions.
So it looks like the ::onReachDestination function moves the aiRat to the next node. Why doesn't the ::moveToNextNode do that? or does it and I just don't understand the function hooks?
Can someone explain the theory behind the functions? Most of the pathFinding tutorials just give script to cut/paste, but I need to learn HOW it works.
Thanks!
Tony
So it looks like the ::onReachDestination function moves the aiRat to the next node. Why doesn't the ::moveToNextNode do that? or does it and I just don't understand the function hooks?
Can someone explain the theory behind the functions? Most of the pathFinding tutorials just give script to cut/paste, but I need to learn HOW it works.
Thanks!
Tony
#2
No console errors being generated.
Any suggestions?
Tony
06/27/2008 (7:00 am)
I can now spawn aiRat on Path1 or on Path2 but not on both at same time. I also spawn aiWolf on either path1 or 2, but I cannot spawn a wolf AND rat on separate paths at the same time. Only a wolf on a single path, OR a rat on one of the paths.%player = aiRat::spawnOnPath("aiRat","MissionGroup/Paths/Path1");No console errors being generated.
Any suggestions?
Tony
Torque Owner Infinitum3D
So the functions go in sequence
spawnOnPath
moveToNode
onReachDestination
moveToNextNode
etc...
I'm assuming moveToNode is called when the bot has moved off a path, and moveToNextNode is called to advance the bot along the path, right? Then why do we need followPath?
I think I'm beginning to understand... but I'm still confused about onEndOfPath... there is no end of path if its a circular path???
onEndOfPath calls nextTask which calls executeTask which I guess determines which task gets called next. I think this allows for other events to occur durng the pathfinding sequence so that pathfinding doesn't become a closed loop of code...
Help!
Tony