Calculating Distance

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Calculating Distance

Post 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
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

local.distance = vector_length ($thing.origin - $tihng2.origin)

and about print3d.. i have no clue.. try it :)
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply