Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
player looking at me? i am behind player? #220246
08/06/08 15:56
08/06/08 15:56
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
hello
help me with this noob question i am scripting after a long time so i forgot some functions.

Q1. How to know if player is looking at me or not?

Q2. How to know if i am exactly behind the player?

Thanx

Re: player looking at me? i am behind player? [Re: iam_ufo973] #220272
08/06/08 18:36
08/06/08 18:36
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline
Serious User
Blade280891  Offline
Serious User

Joined: Jan 2008
Posts: 1,580
c_trace for both i think


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: player looking at me? i am behind player? [Re: Blade280891] #220286
08/06/08 19:30
08/06/08 19:30
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Q1: like blade said, with a c_trace in the direction the player is facing (for optimising speed you could first check if the player is turned at your direction at all, and if so, perform a c_trace to see if there are any objects interfering the player's sight).

Q2: Depends what you mean with 'exactly behind'. Does distance matter? Can objects stand between you and the player? And practically spoken, you can never be exactly behind a player. You will need a definition of what is 'behind'. E.g. define "between 170 and 190 degrees away from player's facing-direction, and within 50 quants" as "behind the player".


Click and join the 3dgs irc community!
Room: #3dgs
Re: player looking at me? i am behind player? [Re: Joozey] #220289
08/06/08 19:43
08/06/08 19:43
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
Thank you guys for your help.
joozey i couldn't understand that you said (for optimising speed you could first check if teh player is tuned at your direction at all)?
how can i check it & it is again the same question i asked? can u give me an example.

And by being exactly behind the player i want the enemy to hold him from behind so other enemies can beat the player ;d

bytheway thanx again guys!

Re: player looking at me? i am behind player? [Re: iam_ufo973] #220298
08/06/08 20:44
08/06/08 20:44
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
look for vec_for_angle in the manual. There's an example of how to turn the player towards something. If you can turn it to some point, then, of course, you can also check if it is looking at that point.


Click and join the 3dgs irc community!
Room: #3dgs
Re: player looking at me? i am behind player? [Re: Joozey] #220400
08/07/08 08:18
08/07/08 08:18
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
Ok Q1 is solved by using c_scan. i prefered c_scan because i can scan in a cone which is i think not possible by c_trace.(i don't know if it slows down speed or not?).

Q2 is still unsolved can someone give me an example on how to find if player is behind an entity? Plase

Once again thanx for your help smile

Re: player looking at me? i am behind player? [Re: iam_ufo973] #220423
08/07/08 10:45
08/07/08 10:45
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
c_scan(enemy.x, vector(enemy.pan - 180, enemy.tilt, enemy.roll), vector(20,20,500), SCAN_ENTS);

play with values 20,20,500...if enemy detects player behind him it will trigger players event_scan



Ubi bene, ibi Patria.

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1