Darwinbots Forum

Bots and Simulations => DNA - General => Tips and Tricks => Topic started by: PhiNotPi on April 20, 2011, 08:55:44 PM

Title: Actual Distance Sensing
Post by: PhiNotPi on April 20, 2011, 08:55:44 PM
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
Title: Re: Actual Distance Sensing
Post by: ikke on April 21, 2011, 02:52:19 AM
http://www.darwinbots.com/WikiManual/index.php/Dist (http://www.darwinbots.com/WikiManual/index.php/Dist)
Title: Re: Actual Distance Sensing
Post by: theblaze on April 21, 2011, 04:30:34 AM
lol read the wikik
Title: Re: Actual Distance Sensing
Post by: PhiNotPi on April 21, 2011, 06:52:23 AM
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.
Title: Re: Actual Distance Sensing
Post by: ikke on April 21, 2011, 04:30:50 PM
Been there done that...
Title: Re: Actual Distance Sensing
Post by: theblaze on April 22, 2011, 02:43:58 AM
Am still
Title: Re: Actual Distance Sensing
Post by: ikke on April 22, 2011, 03:12:31 AM
BTW Nice sig