You should consider looking at FastCast if you want to prevent bullet lag or jittering.
Your logic for determining origin position and target position sounds fine, although you should have sanity checks, e.g. ensuring the player is actually where claim they are (validating origin position) and other such things.