Game Development Community

My bots got stuck ...

by Peter Frisch · in Technical Issues · 09/05/2004 (1:27 am) · 4 replies

Hi there,

I'm pretty new to torque and I ran into a problem with a AI bot. It's not following a path but it's supposed to run away from me. So my idea was to calculate a vector from me to the bot and tell the bot to run to a destination point that points that way. Now th problem if I'm chasing it towards a hill top, the destination point might be floating in mid air and the bot will never be able to reach it (or on a dip, the destination might be under ground). Is there a simple way to make sure the point is *on* the terrain?

Regards, Peter

#1
09/05/2004 (1:40 am)
A) you can set the moveTolerance of the bot, then it won't try to go to the exact location, but in a certain radius. I set the movetolerance to 10 for my bots, experiment with it and see what happens.
b)you could write a function that gets the terrain level. For an example view this code:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2347
#2
09/05/2004 (1:46 am)
Hey, great, thanks. That's exactly what I was looking for
#3
09/06/2004 (4:18 pm)
I wouldn't really bother with this. The OnReachDestination function deals only with X and Y values, so no matter if your destination point is on the air or under the ground, the OnReachDestination will be called.
#4
09/06/2004 (10:27 pm)
I was wondering, why the code didn't work ... after more debugging I figured out that it was a bug in my script and the code for finding a new destination wasn't called anymore ... sorry for the ruckus ... But now I've learned how to calculate a point on the terrain. So for me that wasn't all useless ;o)