Using function to obtain the origin of the target