wierd results from get_distance
1 Attachment(s)
./,),(-*,(.((((((
get_distance and get_distance_f seem to be returning wierd results to me, at first I thought it was isolated but i upgraded the amxx version to 1.76c and I still have the problem. does anyone know why it would return values like ./,),(-*,(.(((((( i was displaying this as a float. on a side topic, i built my own distance function and while it didnt return values like the one above it returns either very large numbers or negative numbers and just gives unpredictable results does anyone know why it does? attached is the custom distance function if i recall the distance forumula is somewhat simple: sqroot((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2) |
Re: wierd results from get_distance
If you can sucessfully reproduce it, like you say, then I'd submit a bug report.
|
Re: wierd results from get_distance
sqroot( ( x1 - x2 )^2 + sqroot( ( y1 - y2 )^2 + ( z1 - z2 )^2 )^2 )
This only works if: x1 >= x2 && y1 >= y2 && z1 >= z2 I believe this would be the correct useage, made this just to test some weeks ago. Code:
|
Re: wierd results from get_distance
Instead of all those ifs I'd just use abs/floatabs.
|
Re: wierd results from get_distance
Quote:
|
Re: wierd results from get_distance
Why would you do that, Black Rose? btw, abs is absolute value, for example abs(-1) = 1
Code:
Code:
POWER: 1, 1.000000 |
Re: wierd results from get_distance
i dont think it should matter (mathematically) whether x1 >= x2 because lets say it isn't
Assume x1 = -5 and x2 = 2, adding them together will give -3, well distances can't be negative right, but then you square that, and anything squared is positive so it shouldn't matter, however, somewhere in the programming it may get messed up, I ended up ripping out a function out of a plugin on the forums the one that lets you voice chat to only nearby players... this method DOES work and works well... Code:
|
Re: wierd results from get_distance
Quote:
No it doesn't Code:
Code:
|
Re: wierd results from get_distance
Author, can you show us how exactly to reproduce the issue?
|
Re: wierd results from get_distance
1 Attachment(s)
Sure, here is a simple plugin that gives me the problem
to test go load plugin go into game and say /testdistance and it will tell you your distance to the arbitrary point (150, 150, 150) which comes out gibberish. |
| All times are GMT -4. The time now is 00:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.