### Author Topic: Actual Distance Sensing  (Read 4075 times)

#### PhiNotPi

• Bot Builder
• Posts: 64
##### Actual Distance Sensing
« 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
I am biased neither towards nor against any single mathematical constant.

#### ikke

• Bot Destroyer
• Posts: 300
##### Re: Actual Distance Sensing
« Reply #1 on: April 21, 2011, 02:52:19 AM »

#### theblaze

• Bot Builder
• Posts: 82
##### Re: Actual Distance Sensing
« Reply #2 on: April 21, 2011, 04:30:34 AM »
lol read the wikik

#### PhiNotPi

• Bot Builder
• Posts: 64
##### Re: Actual Distance Sensing
« Reply #3 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.
I am biased neither towards nor against any single mathematical constant.

#### ikke

• Bot Destroyer
• Posts: 300
##### Re: Actual Distance Sensing
« Reply #4 on: April 21, 2011, 04:30:50 PM »
Been there done that...

#### theblaze

• Bot Builder
• Posts: 82
##### Re: Actual Distance Sensing
« Reply #5 on: April 22, 2011, 02:43:58 AM »
Am still

#### ikke

• Bot Destroyer
• Posts: 300
##### Re: Actual Distance Sensing
« Reply #6 on: April 22, 2011, 03:12:31 AM »
BTW Nice sig