Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, kzhao, 7th_zorro), 714 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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