Game Development Community

Pausing an object on a Path

by Academy of Interactive Ent. #09 · in Torque Game Builder · 07/07/2008 (7:12 pm) · 1 replies

I have tried multiple efforts with using a path and pausing an object on it. I have tried searching everywhere to no avail.

What I want to achieve is when the player gets within a certain distance stop the object on the path and get it to face the player. Working when to stop, and getting the object to face the player is the easy part.

What I am finding hard is to stop the object and then to resume it on the path.

Setting the object's path speed, or orient resets the object to the start node of the path, which is useless (but it does now stop and face the player)

I can detach the object from the path which does the job. But I need to reattach the enemy to the path at a later point (when the player gets out of range) doing this sends the object back to the starting node (not snapping to it, but travelling as the crow flies towards it), I cannot seem to find the target node to set that as the starting point.

The last approach I tried looked promising, I created an onUpdatePath callback for the paths, but the vectors being passed into %to and %from are incorrect. The Y coordinate is always the same as the X, so its completely unusable.

I am using TGB 1.72. The documentation is pretty sparse on paths and such, anyone got any ideas?

Thanks in advance

About the author

Recent Threads


#1
07/07/2008 (9:19 pm)
Nevermind, I got a solution, find a forum post with someone using the onReachNode callback on the path, I use that to get the node the object is travelling towards, and set that as the start node when I reattach the object.