Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / A quick questions....Cause I stink at math.

Author
Message
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 26th Aug 2010 17:29
First question....
If I use this to find distance:

I posiiton object one at 520,0,520 then object 2 at 500,0,500, I get a distance of 800. Why is d# so large of a number?

Mike

some cool stuff someone else said here
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Aug 2010 17:45
That's actually the SQUARE of the distance. You need to get the SQUARE ROOT of that for the actual distance.

Lots of people leave it in squared form and just square the distances they're checking against though since the SQUARE ROOT (SQRT) command can be slow if you're checking the distance a lot.


Guns, cinematics, stealth, items and more!
Alpha Mike
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location: Bristol, UK
Posted: 26th Aug 2010 23:24
Are vectors not designed to get the distance between two points (in 2D and 3D space)?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 27th Aug 2010 06:17
Quote: "Are vectors not designed to get the distance between two points (in 2D and 3D space)? "

Yes, you could also get distance with a vector, but it basically uses this formula AFAIK.


Latest progress: Fog of War implemented

Login to post a reply

Server time is: 2024-09-28 20:34:30
Your offset time is: 2024-09-28 20:34:30