void UpdateRelativePosition() { double[] y = source.Position; double[] x = target.Position; double dist = 0; for (int i = 0; i < 3; i++) { double dd = y[i] - x[i]; dist += dd * dd; relative[i] = dd; } distance = Math.Sqrt(dist); ReferenceFrame f = ReferenceFrame.GetOwnFrame(target); f.CalculateRotatedPosition(relative, relativePos); }