No problem, Michael, this is exactly what I am doing:
Code:
pBotEar->noises[selected_index].direction = BotEstimateDirection (pBot, v_origin);
BotEstimateDirection translates a vector location in a general direction from the following ones:
- rather in front of the bot
- rather ahead on the left
- rather on the left
- rather behind on the left
- rather behind it
- rather behind on the right
- rather on the right
- rather in front on the right
Code:
// relative directions
#define DIRECTION_NONE 0
#define DIRECTION_FRONT (1 << 0)
#define DIRECTION_BACK (1 << 1)
#define DIRECTION_LEFT (1 << 2)
#define DIRECTION_RIGHT (1 << 3)
these are bitmasked
Distance is not taken in account, it's only the angle at which the sound comes to the bot. I believe it's more natural that way than to inflict (yet another) arbitrary randomization, what do you think ?