Raised This Month: $ Target: $400
 0% 

some functions about math


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hzqst
Senior Member
Join Date: Jul 2008
Old 03-15-2009 , 04:28   some functions about math
Reply With Quote #1

Quote:
stock Float:math_GetAngle(Float: x1, Float:y1, Float: x2, Float:y2){
new angle
floatatan2(y2 - y1, x2 - x1, angle)
return float(angle)
}
Quote:
stock Float:math_GetDistance (Float:x0, Float:y0, Float:x1, Float:y1){
return sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))
}
Quote:
stock Float:math_PolarX12 (Float:x,Float:angle,Float:distance){
return (x+floatcos(angle)*distance)
}
Quote:
stock Float:math_PolarY12 (Float:y,Float:angle,Float:distance){
return (y+floatsin(angle)*distance)
}
are these functions correct?

I want to get 4 positions like this:
Quote:
X-X
-O-
X-X
-P-
X:the position which i need to get
O:where the player aims
P:player
Xs depend on where the player aims:

Quote:
-X
XOX
-X
-P

Last edited by hzqst; 03-15-2009 at 04:31.
hzqst is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-15-2009 , 05:01   Re: some functions about math
Reply With Quote #2

Have a look at xs.inc, there is usefull stocks.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:52.


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