|
Re: c_trace and direction
[Re: GaniX]
#425329
07/02/13 22:37
07/02/13 22:37
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Trace to your point of interest (player or other enemy), if !trace_hit, calculate the angle from the direction of your entity to that object, for instance as follows:
c_trace(my.x,object.x,...); if(!trace_hit) { vec_diff(temp,object.x,my.x); vec_to_angle(temp2,temp); // now compare the ANGLE temp2 to the my-orientation to check if the object is in the field of view of the my entity if(abs(ang(my.pan-temp2.x)) < 90 && abs(ang(my.tilt-temp2.y)) < 50) { object is visible in front of my-entity } }
I hope this is what you wanted to do. Alternatively you can adapt the scan cone of the c_scan instruction (i.e. not use a full-sphere scan) and combine it with c_trace, then you should not have to compare any angles at all.
Regarding your second question, did you mean "mirror" instead of "window"? If it's only a window you want to ignore you could use the c_ignore feature.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: c_trace and direction
[Re: Superku]
#425330
07/02/13 23:08
07/02/13 23:08
|
Joined: Apr 2012
Posts: 106
GaniX
OP
Member
|
OP
Member
Joined: Apr 2012
Posts: 106
|
ok i will study this idea you say, but are you sure the ray in the c_trace will turn wiht this?, is say turn when the enmy turn o turn when the player look down or up or else ... because i use the trace isntruction to make the shoot
and for the 2 problem i say : if the ray hit an glass, window, door , or else, how can i get the angle of this hit to continue the ray . supouse the ray hit a window in 45º How can i get the angle to continue the ray ?, How continue the ray?
Last edited by GaniX; 07/02/13 23:22.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|