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
3 registered members (TipmyPip, OptimusPrime, AndrewAMD), 14,882 guests, and 6 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
Measure the distance between two objects? #223339
08/23/08 15:18
08/23/08 15:18
Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
O
Omicron_NEGA Offline OP
Warez kiddie?
Omicron_NEGA  Offline OP
Warez kiddie?
O

Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
i tried c_trace but that didnt work
so can some one tell me hoe to do it?
thx!


P4 3.6GHz x2 8GB RAM DDR2 GeForce8800GTS
Re: Measure the distance between two objects? [Re: Omicron_NEGA] #223345
08/23/08 15:34
08/23/08 15:34
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
u can use vec_dist(objct1,object2);

if you want to store the distance you could declare a var like

var object_distance;
object_distance=vec_dist(objct1,object2);

there might be an easier way but thats how i would do it

hope that helps


Last edited by badapple; 08/23/08 15:36.
Re: Measure the distance between two objects? [Re: Omicron_NEGA] #223346
08/23/08 15:34
08/23/08 15:34
Joined: Mar 2003
Posts: 3,010
analysis paralysis
NITRO777 Offline
Expert
NITRO777  Offline
Expert

Joined: Mar 2003
Posts: 3,010
analysis paralysis
To measure the distance between 2 points you would use the distance formula, but game studio already has functions for getting the distance:

distance = vec_dist(my.x, your.x);

Re: Measure the distance between two objects? [Re: NITRO777] #223351
08/23/08 16:01
08/23/08 16:01
Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
O
Omicron_NEGA Offline OP
Warez kiddie?
Omicron_NEGA  Offline OP
Warez kiddie?
O

Joined: Aug 2008
Posts: 63
=Strogg=3rd_com_cent.
that works...
maybe i should read more about the manual
thank you,and badapple too!


P4 3.6GHz x2 8GB RAM DDR2 GeForce8800GTS
Re: Measure the distance between two objects? [Re: Omicron_NEGA] #225031
09/02/08 16:50
09/02/08 16:50
Joined: Aug 2008
Posts: 11
S
silently99 Offline
Newbie
silently99  Offline
Newbie
S

Joined: Aug 2008
Posts: 11
hi i have a similar question.
How do i calculate the distance between the player and a third entity.
for example my player come in contact with this door, how do i calculate the distance from the player to the next door? How do i give the model i created in WED a name in the script?

float distance;

function distance_event(){
..
distance = vec_dist(you.x, ????.x);
..
}

action detect(){

my.emask = ENABLE_IMPACT;
my.event = distance_event;

}

Thanks all

Re: Measure the distance between two objects? [Re: silently99] #225033
09/02/08 17:06
09/02/08 17:06
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
The event offers you a pointer to the object.
One of them is 'me' and the other is 'you'.
To find out which pointer you get in a certain case, you have to read the manual about events carefully!

Re: Measure the distance between two objects? [Re: Pappenheimer] #225039
09/02/08 17:18
09/02/08 17:18
Joined: Aug 2008
Posts: 11
S
silently99 Offline
Newbie
silently99  Offline
Newbie
S

Joined: Aug 2008
Posts: 11
yeah i understand that, i mean is there a way to get another entity position(which is not my and you) when i trigger the event. Hope you understand what i meant >_<

Re: Measure the distance between two objects? [Re: silently99] #225059
09/02/08 18:09
09/02/08 18:09
Joined: Aug 2008
Posts: 11
S
silently99 Offline
Newbie
silently99  Offline
Newbie
S

Joined: Aug 2008
Posts: 11
nvm i think i got it.

ENTITY* door2;
int distance;

door2 = ent_for_name("door2");
distance = vec_dist(door2.x, player.x);


Is it just me or float distance doesn't work.


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