bot facing direction, without destiny position

Started by
0 comments, last by Zakwayda 18 years, 10 months ago
Hi, I'm with a little problem, that i don't see how to fix it. My bots code, works nice, including the direction facing, etc, while they move around. But, supose the bot starts in idle mode, like if he his guarding some position. He has a position, a angle to where he his facing ( angle is selected in the editor), but it has no direction, so, i don't know how to calculate the direction the bot is facing. Any ideias ? thanks, Bruno
Advertisement
The direction can be calculated from the angle. A typical solution in 2d is direction = (cos(angle), sin(angle)). If your bot AI is 2d, that or a variation thereof is all you need to find the direction vector.

This topic is closed to new replies.

Advertisement