Page 1 of 1

Calculating Distance

Posted: Sun Sep 25, 2005 8:06 pm
by GiffE1118
A little odd but im trying to get the distance between 2 origins

like from a players origin to a location shot (shot triggger)
then convert it to feet. i think 60 units is ~ 3 feet. not sure

I looked through g_allclasses.html and saw

vector_subtract( Vector vector1, Vector vector2 )


Returns vector1 - vector2
so i was thinking

local.dist = vector_subtract ( local.player.origin $trig.origin )

but it would give back 3 numbers

and i only need one

since ( x y z ) is an array i could do
local.dist[1]
local.dist[2]

leave out the 3 since that is hieght

should i add the 2 or what should i do to them to get the length of the shot

^ this is what i need help on

after i get that num (if i get that far)
i could
multiply the outcome by 20 to come up with the feet


i also have another question.

does
print3d( Vector origin, String string, [ String [strings] ] )


prints a string in 3D space
do anthing. sounds pretty cool but never heard of it. and i know a few things in that allclasses dont work

Posted: Sun Sep 25, 2005 9:38 pm
by Master-Of-Fungus-Foo-D
local.distance = vector_length ($thing.origin - $tihng2.origin)

and about print3d.. i have no clue.. try it :)

Posted: Mon Sep 26, 2005 12:23 am
by lizardkid
print3d does not work, in fact most of the prints dont work.

print3d would put writing on an object, floating 2d writing... hard to explain.