Just so you know questions about coding belong in the DBPro, DBC, or Newcomers boards.
(DBPro board if you use DBPro, DBC board if you use DBC, and Newcomers board if you don't know what you are doing)
The distance between two points [(x1,y1,z1) and (x2,y2,z2)] is
sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2)
but i don't think that's what you want... from your post it seems like you want to be able to look down a sniper rifle or something and see how far away the thing you are pointing at is...
what i would do is make a tiny invisible sphere, position it at the front of your gun (or wherever you want the distance checking to start) then use "Intersect object"
INTERSECT OBJECT
This command will return the distance to the point of intersection between two coordinates, in reference
to the specified object. Use this command to project a line from your current position to a destination to
determine whether a collision will occur with an object. Ideal for bullet calculations and fast manual
polygon collision.
SYNTAX
Return Float=INTERSECT OBJECT(Object Number, X, Y, Z, ToX, ToY, ToZ)
setting the second point to a far away point on the same line that your gun is pointing on...
that probably made no sense whatsoever (i'm not very good at explaining things sometimes)... but oh well
--Peter
"We make the worst games in the universe..."