Talk:.edge

From WikiManual
Revision as of 03:01, 26 December 2005 by Numsgil (talk | contribs)
Jump to: navigation, search

Example:

'this will turn a bot a random number of degrees upon hitting an edge.
314 rnd .aimdx *.edge mult store

This will turn the bot by a rnd amount between 0 an 90 degrees ... clockwise, yes?
and 314 rnd .aimsx *.edge mult store, 0-90 degress CCW?

If one wished to have the bot turn either CW or CCW ...
what would be the best way to do so?
will this work?:

628 rnd .aimdx *.edge mult store
-314 .aimdx store

resulting in the bot rotating 0-90 degress to the left or right?

or:

314 rnd .aimdx *.edge mult store
-314 rnd .aimdx *.edge mult store

or:

314 rnd .aimdx *.edge mult store
314 rnd .aimsx *.edge mult store

resulting in smaller values near 0 degrees being more probable,
ie ... the distribution being more closely centered around zero?
Assuming any of the above would work ...
Which of these would be more costly for the bot?

Also ... perhaps the above is moot, eh?
How much of this is taken care of by the new physics of 2.4.X?
where the velocity and momentum is used to simply 'bounce' the bot
off of the 'edges'?
IOW ... do the physics take care of the bot's heading as part of
the bot's velocity vector, including the direction it is facing ...
or just it's delta x and delta y?
ie ... is it any longer necessary to rotate the bot?
[haven't had time to actually experiment and gather empirical data yet. i will.]
tanks.
Griztalk



If you're talking about rotating either left or right 90 random degrees upon sensing something, the best suggestion I could make would be to use something like:

' rotate either left or right 90 degrees upon hitting edge
314 rnd 5 *.edge mult 1 rnd add store

Not really sure why you'd want to though. The turning CW and then CCW would likely be inefficent, one rotation largely canceling out another.

You'll have to ask Nums about the vector addition, not my strong suit I'm afraid. --Endychat 20:55, 25 Dec 2005 (MST)

The edges are set up to be springy, so as a result correct vector collision math will work. Note that it's not directly programmed in that way, but is mroe a natural consequence of how the forces interact. --Numsgil 01:01, 26 Dec 2005 (MST)