Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualTiagoCosta

Posted 17 January 2013 - 11:34 AM

@TiagoCosta: Need a little bit of more clarification.

playerPos is the beginning of the cone (enemy eyes position)? Is that true?
someNumber is how far the enemy can see.
someOtherNumber: How do I get this value?
Sorry I didn't had time to comment the code before.

I updated the code in my last post... should be easier to understand.

#1TiagoCosta

Posted 17 January 2013 - 11:24 AM

@TiagoCosta: Need a little bit of more clarification.

 

playerPos is the beginning of the cone (enemy eyes position)? Is that true?

someNumber is how far the enemy can see.

someOtherNumber: How do I get this value?

 

Sorry I didn't had time to comment the code before.

 

I updated the code a bit

 

playerPos is the position of the player (you're eyes position).

enemyPos is the position of the enemy that might be "seeing" the player.

view is a vector from the enemy position to the player position.

someNumber was indeed how far the enemy can see.

someOtherNumber (now cosMaxAngle) is the cosine of half the field of view angle of the enemy.


PARTNERS