To get the vector between the “touch” and the “player”, you take the difference:
local diff = touch_pos - player_pos
To extend that vector, you can use multiplication:
local diff = (touch_pos - player_pos) * 1.5
If you need an exact length of the vector, you need to normalize it, and here you’ll need to make sure it isn’t a zero length vector (to avoid getting NaN’s):
local scale = 1.5
local diff = touch_pos - player_pos
local length = vmath.length(diff)
if diff < 0.001 then -- avoid NaN's,
diff = vmath.vector3(1,0,0) -- pick an arbitrary direction
else
diff = vmath.normalize(diff)
end
-- diff is now of length 1
diff = diff * scale