Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 17,416 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
calculating the distance #270971
06/10/09 18:16
06/10/09 18:16
Joined: Feb 2007
Posts: 77
São Paulo, Brazil
AttosRH Offline OP
Junior Member
AttosRH  Offline OP
Junior Member

Joined: Feb 2007
Posts: 77
São Paulo, Brazil
how do I calculate the distance between 2 models?

c_trace?
c_scan?

thanks in advance

Re: calculating the distance [Re: AttosRH] #270974
06/10/09 18:26
06/10/09 18:26
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
vec_dist( my.x, you.x )


Click and join the 3dgs irc community!
Room: #3dgs
Re: calculating the distance [Re: Joozey] #270977
06/10/09 18:32
06/10/09 18:32
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
alternatively you can use the Pythagoras
(in case you handle your vectors seperated as variables, and
want do a "selfmade" calculation)

a*a+b*b=c*c

or:

c=sqrt(a*a+b*b)

Re: calculating the distance [Re: Damocles_] #270978
06/10/09 18:37
06/10/09 18:37
Joined: Feb 2007
Posts: 77
São Paulo, Brazil
AttosRH Offline OP
Junior Member
AttosRH  Offline OP
Junior Member

Joined: Feb 2007
Posts: 77
São Paulo, Brazil
Originally Posted By: Damocles_

a*a+b*b=c*c

or:

c=sqrt(a*a+b*b)


O.o

Re: calculating the distance [Re: AttosRH] #270981
06/10/09 18:39
06/10/09 18:39
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Where a = my.x - you.x and b = my.y - you.y.
c is the distance


Click and join the 3dgs irc community!
Room: #3dgs
Re: calculating the distance [Re: Joozey] #270983
06/10/09 18:43
06/10/09 18:43
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Yes, forgot to add that.
Its just the classic way to calculate distances in
geometry. (a and b beeing the "x" and "y" distances between
the objects positions)

-> its more useful when you dont want the (z) hight of the objects
to influence the distance.

Re: calculating the distance [Re: Damocles_] #270985
06/10/09 18:46
06/10/09 18:46
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
You can also use (a*a)+(b*b)+(c*c) = d (d is the distance², a-c = x-z). I assume that you are using a 3D Space...

Last edited by Sylar; 06/10/09 18:47.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1