I'm trying to set up waypoints for an airplane "in air" at various Y heights. All scripts I have tried rely on horizontal locations. How can I acheive an enemy finding the location of a way point in the closest x,y,z location? rather than only on one axis.
asked Dec 01 '10 at 05:37 AM
Some code that I wrote a while back. Just sctter the waypoints in 3D space and drag them in order one by one into waypoints array. And it will move in that loop that you have
You might wanna add a few things such as facing the waypoint towards which the object is moving. I didn't need it in my project so I didn't write all that. To make the object find the nearest waypoint, just use something like this in the start function:
After this,simply make the object face nearestWaypoint and move towards it.You will need to have a boolean variable that becomes true when the object reaches the nearest waypoint and only when this variable is true, the update function does all that it needs to do, moving to the next waypoint and face them and all.
Hope this helps
answered Jan 01 '12 at 06:06 AM