Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
FROGGIE!
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 26th May 2004 18:18
How can you tell if an enemy is looking at you ?

eg. You can stand behind him but not in front(or 45 degrees either side of the front) without him knowing.

im only using the X+Z axis so you dont need to bother with the Y axis.

I should have changed my signature when asked
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 26th May 2004 19:16
I'm not very good at AI either so here's what i'd do:
Make an object like this:

Then position it in front of your enemy (hidden).
Then if there is a collision between that and the player then it can see you.
Hope that helps.

Current Projects: Dark_Worlds_Map_Editor version0.1 [email protected]
Macrosii
21
Years of Service
User Offline
Joined: 31st Mar 2004
Location: Essex, UK
Posted: 27th May 2004 22:17
Maybe use dot produect to calc angel between the two. Something like.

Set Vector3 ShipVector, Object Position X(you), Object Position Y(you), Object Position Z(you)
Set Vector3 EnemyVector, Object Position X(Enemy), Object Position Y(Enemy), Object Position Z(Enemy)
phi#=dot product vector3(you, enemy)
anglebetween#=acos((phi#)/(length vector3(targvector) * length vector3(shipvector)))
if angle between < FovAngel /2 then seeyou$ = "yes"
NathanF
21
Years of Service
User Offline
Joined: 24th Mar 2004
Location:
Posted: 28th May 2004 01:45
The easy way is to position the camera on the AI, and rotate it right. Then check if the player is on the screen, and move back the camera.

.........what's the point of reading this?

Login to post a reply

Server time is: 2025-05-24 00:30:48
Your offset time is: 2025-05-24 00:30:48