How would you get a point that is a distance from another? (2D Vectors)
Posted: Tue Jun 04, 2019 12:11 pm
So I am making a game with a diablo style of movement and when the player clicks on an npc to say talk to them i need to get the point that is between the player and the npc that is a set distance from the npc to move the player to. I am honestly bad at math so if anyone could help me with this? I had been searching around on google and got something like this:
but it only moves the player closer with the father away the player is.
Code: Select all
%interactionDistance = 4; %interactX = %objectX + (%playerX - %objectX) / %interactionDistance; %interactY = %objectY + (%playerY - %objectY) / %interactionDistance;