Find position of point beetween two objects on certain distance

Hello, maybe this question is a bit dummy. I’m not very good in math.

My problem is in topic title. A picture is attached to show it. I have mouse position, ball position and line length. I want to know point position at the end of line. And when I move mouse, that point changes.


You save time if you look at the unity answers, try 2-3 searches on same topic with similar phrases.

you can make a line of XYZ length by doing position A minus position B

var line  = objecta.pos - objectb.pos

That way you have a line going from one to the other.

if you want halfway, do:"

var newdistance = (line.x * .5,line.y *.5,line.z*.5) ;

then add that to object a to find point between":

new point = newdistance + objecta.pos;

I am sure i asked the same question once, and so did everyone, except perhaps i found it on the forums using google search i dunno. it’s not so obvious.

c u