Bots and Simulations > Tips and Tricks

Actual Distance Sensing

(1/2) > >>

PhiNotPi:
Here is code to find the actual linear distance between the bot and the bot that it is looking at, not the inversely proportionate number given by the focus eye, which depends on the width of the eye (I think).  It is based off of the Pythagorean Theorem.

def distance 51
*.refxpos *.xpos sub *.refxpos *.xpos sub mult *.refypos *.ypos sub *.refypos *.ypos sub mult add sqr distance store

ikke:
http://www.darwinbots.com/WikiManual/index.php/Dist

theblaze:
lol read the wikik

PhiNotPi:
I thought that I had looked all over the wiki for something that told the actual distance.  But it is actually a good thing that I now know about the "advanced commands." It makes programming bots a whole lot easier. 

If you can't tell, I'm a newbie.

ikke:
Been there done that...

Navigation

[0] Message Index

[#] Next page

Go to full version