Raised This Month: $ Target: $400
 0% 

Math Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 06-09-2006 , 17:17   Math Help
Reply With Quote #1

Code:
get_user_origin(temp, temp, 0) //where his at get_user_origin(temp, temp, 3) //where his aiming
Is there anyway you can find out if a player is close from that line?
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-09-2006 , 17:25  
Reply With Quote #2

well depends on what u want to do. In the case that you specified, if you are simply finding a player between his aiming and his end aiming you can simply do get_user_aiming. If you are trying to find out if a player is on a line that is not from a player's crosshairs to a player's end aim point, you could circle through 1-get_maxplayers() and see if they are on the line with simple algebra.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 06-09-2006 , 17:32  
Reply With Quote #3

Im trying to find out if the user is close to that line. Like in is_user_visible.
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-09-2006 , 17:35  
Reply With Quote #4

then y not use is_user_visible? maybe I am misunderstanding.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 06-09-2006 , 17:37  
Reply With Quote #5

not working
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-09-2006 , 17:45  
Reply With Quote #6

I thought someone had told me one time that they had fixed it because instead of doing

Code:
if(!visible)
   return 0;

return 1;
they had done

Code:
if(!visible)
   return 1;

return 1;
but they caught it and fixed it. Maybe they de-fixed it. Maybe someone lied to me.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
VEN
Veteran Member
Join Date: Jan 2005
Old 06-10-2006 , 04:06  
Reply With Quote #7

So you want to find a distance from the closest line point to the player?

By the way is_in_viewcone and is_visible is broken (<1.75) but you can use fm_is_visible and fm_is_in_viewcone from the Fakemeta Utilities
VEN is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 06-11-2006 , 11:58  
Reply With Quote #8

Code:
<Aim>
|
| o <- Victim
|
|
| 
<Attacker>
Finding the distance of a player from that line.

I total forgot about your Fakemeta Utilities, going to try that..
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 06-11-2006 , 12:27  
Reply With Quote #9

atm i only know one way:

you have an triangle here.

A = Attacker
B = AIM
C = VICTIM

a = distance(aim, victim)
b = distance(attacker, victim)
c = distance(attacker, aim )

hc = distance from line to victim

so something like this could work:

s = (a+b+c)/2
area = sqrt(s *(s-a)*(s-b)*(s-c))

area = c * hc /2
hc = 2 * area / c

maybe this is not the best way, but it is a way ;)
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
KoST
Senior Member
Join Date: Jul 2005
Old 06-11-2006 , 12:53  
Reply With Quote #10



__________________
KoST is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode