Jump to content
  • Advertisement
Sign in to follow this  
Bruno

bot facing direction, without destiny position

This topic is 4735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!