Object Seeking
Function Seeker()
This Spider is somewhat autonomous in that we tell it to find an object, the spider looks for the object, and turns toward it each walk cycle. We don’t need to manually animate the turns the spider takes in order to find the object.
Object seeking is surprising simple. The distance between a seek object and 5 relative positions around the spider’s guide object are tested to find the shortest distance. Depending on which measurement is the shortest, the Spider will rotate a limited amount on it’s local Z_Axis each time the Seeker() function is called. In this Spider on a Tree animation, the Seek Object is on the end of the tree limb. No other instructions to find the Seek Object are given besides the single Z_Axis rotation.
 
Page 9