help - function for is ObjectA facing ObjectB?

Hi all,

there should be a simple solution for this, although I can’t seem to find a suitable function.

What I want to do is test if the player is facing an enemy, can anyone offer any suggestions?

thanks,

  • Mel

why don’t you try Raycast ?

I tried raycasting but it really slows down my iphone project. I’m trying to find a non - physics way of doing it.

Thanks,

  • Mel.

Standard vector mathematics: the dot product of two vectors relates to the angle between them. Use the dot product of the player’s transform.forward and the enemy’s transform.position.

Hi Laurie,

exactly what I needed - thanks!

  • Mel