Orienting multiple objects on the same line

Hello, I am trying to create a mini golf game. I am having a bit of trouble figuring out an issue. When the golf ball is at rest and has stopped moving, I would like the golf club to re-orient itself a short ways behind the ball. However, I would like it to be positioned in such a way that it is auto-aiming for the player, facing the hole. So, imagine if a line is placed from the center of the hole to the center of the ball, the golf club would be on that same line, just a bit behind the ball and facing the ball. I have looked into using Vector3.Angle and several other methods, but I am still a bit lost. Any help would be appreciated. Thanks a lot!


You can get placement like this:

var v3 = (ball.transform.position - hole.transform.position).normalized;
club.transform.position = hole.transform.position + v3 * ball_distance;

‘ball_distance’ is the distance you want the club away from the ball. Assuming you have the club constructed so that positive ‘z’ is forward, and the ball is rolling on the X/Z plane, you can do this to rotate the club:

var v3 = hole.transform.position;
v3.y = club.transform.y;