Code center > Suggestions
I am back...
Griz:
--- Quote ---as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+(y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
--- End quote ---
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
Botsareus:
NUM SAYED (MY TRANSLATION): YOU NEED TO CHANGE BOTH X AND Y. THEREFOR I SAY DO BOTH OF THE FOLLOWING EACH TIME OR DIE TRYING:
err... ok I goofed
RespownX = feildwith /2 + (feildwith /2 - X)
RespownY = feildheight /2 + (feildheight /2 - Y)
simplfy:
RespownX = feildwith - X
RespownY = feildheight - Y
I NEVER SAYED THIS CODE (EHM 'MATH') WAS CONSISTING OF TWO SEPORATE PARTS.
Botsareus:
--- Quote ---That is, Respawn X = some function of current X and Y.
--- End quote ---
Totaly wrong: see picky:
Numsgil:
--- Quote ---
--- Quote ---as soon as a bot reaches the 'border' or strays across it by some tiny amount
[the smaller interval the better] ...
ie ... (x^2)+y^2)>radius^2 by some small amount ...
do you not know it's exact position and can you not calculate the angle from the
center of the field at which this occurs?
--- End quote ---
in fact ... no need to calculate the angle is there?
if the interval is small enough, (guess it would be the bots' velocity)
then why not simply swap x and y polarity ...
thereby placing the bot in the opposite quadrant ...
and allow the next velocity displacement to carry it back inside the field?
this make any sense?
is it too simple? ;)
--- End quote ---
That sounds right actually, assuming you're centered at 0,0 (and you're circular instead of elliptical, I think).
Numsgil:
Bots, I don't think your math is right for the simple reason that:
suppose width and height = 200 (that is, a circle with radius 100)
Assume a point at 45 degrees on the cusp of out of bounds. It's coordinates are: (sqr(2)/2*100, sqr(2)/2*100) = (70.7, 70.7)
By your equation, this then becomes:
X = 200-70.7 = 129.3
Y = 200-70.7 = 129.3
When it's easy enough to see that it should instead be:
180 + 45 = 225
(cos(225)*100, sin(225) * 100) = (-70.7, -70.7)
Griz's proposed idea of simple flipping the sign works in this case.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version