Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advanced targeting
#1
I curious  - how exactly direction function works?
May some one share his/her own example of code, in which used only position of me and target, and their YAWN,ROLL, and so on.
#2
direction() returns returns value which needs to be inserted to turn() in order to make bot face certain position. Ex:

turn(direction(item.position));

Will make bot turn towards item

But I think you might think about object's information, and not instruction. In that case I honestly can't help, since I never really used .direction, .yaw and .roll
"Deep within all of us lives an idiot, and if you let that idiot dictate your decisions your live is going to be rough."
~ Ryan Letourneau, 2k15
#3
It's something similar to this (untested, may not work as I wrote it from memory):
Code:
float object::direction(point pos)
{
    float x = atan2(pos.y-this.position.y, pos.x-this.position.x)-this.orientation;
    if (x > 180) x = x-360;
    return x;
}
#4
it works perfectly! You have a good memory))


Forum Jump:


Users browsing this thread: 3 Guest(s)