View Full Version : Expression for world distance between objects

Boris Goreta
07-12-2007, 06:41 AM
Hi, I am trying to write an expression which would calculate distance from Camera to focal point (null object).
So far I've come up with this:

sqrt ( pow((Camera.Position.X-FPOINT.Position.X),2)+pow((Camera.Position.Y-FPOINT.Position.Y),2)+pow((Camera.Position.Z-FPOINT.Position.Z),2) )

but since Camera is parented to another null it doesn't work since I need world coordinates of Camera.

How do I do that ?

Thanks !

07-12-2007, 06:51 AM
How about this?

vmag( Camera.wpos(Time)- FOCUS.wpos(Time))

07-12-2007, 07:34 AM
btw there's a range finder in the expression builder to help you construct this expression

Boris Goreta
07-12-2007, 09:47 AM
Thanks a lot, it works.