Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
AI sight question
Topic Started: Nov 5 2012, 03:48 AM (277 Views)
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
I'am using FOV and Ray casting to check to see if the player is visible. It would work good but if the ray intersects part of the map, FOV checking gets nulled, UNLESS the player's distance is smaller than the AI's Ray distance (or line of sight. See below).

I guess what I could do is find the area between where the AI's FOV starts and the ray cast. Then determine if the player is within this area.
so...

FOV = / \
RAY = |
FOV + RAY = / | \

Area to find : / | or | \

Helps?

Posted Image
Edited by RonBurgundy, Nov 5 2012, 03:49 AM.
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
alexmach1
Member Avatar
Graphics addict
[ *  *  *  *  *  * ]
you can use a 3D point function to get the rotx and roty between the player and enemy;

Code:
 
//FaceObject(x,y,z,objx,objy,objz)
X=argument3-argument0
Y=argument4-argument1
Z=argument5-argument2
var vector;
vector = CreateVector( -1, X, Y, Z );
Longi = CalculateVectorLongitude( vector );
Lati = CalculateVectorLatitude( vector );
ReleaseVector( vector );

then, using Longi (rotx) and Lati (roty), you can check the difference of the rotations with the enemy;

Code:
 

FoV=45
rotxx=Longi-rotx
rotyy=Lati-roty

if abs(rotxx)<FoV && abs(rotyy)<FoV {
//HOLY CRAP ITS THE PLAYER HRRRRNGGG
//this is where you run your raycast function ;)
}


Edited by alexmach1, Nov 5 2012, 04:15 AM.
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
MysteriXYZ did an example of this if I remember correctly.
Offline Profile Quote Post Goto Top
 
Reikyrr
Forum God
[ *  *  *  *  *  * ]
Despellanion
Nov 5 2012, 11:09 AM
MysteriXYZ did an example of this if I remember correctly.
http://s9.zetaboards.com/Ultimate3D_community/topic/173865/1
Its in the example list topic which is pinned in the Tutorials and examples forum.
~Inspirational quote~
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
@Alex thanks for that ill try it tmrw.

Desp and Reikyrr I do know about that example but I don't think it's exactly what I'm getting after, but it may be I'll have another look thanks.

E D I T : Thanks to everyone for there suggestions. I took another look at Mysteri's example. I basically used the same idea in the example: DO a raycast that always points to the player. Use the GetIntersectedObject script to see if there is anything in between the player and the ray.
Using angle difference, calculate an FOV use if statements to check the FOV( if angle_difference > FOVrange ), and also checking that the intersected object is the player. Bingo! :yahoo:
Edited by RonBurgundy, Nov 7 2012, 07:36 AM.
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply