Hi,
I've got the following problem:
I'm developing a point&click adventure and use paths for player movement.
When clicking left mouse button I scan for the node next to the current mouse position and set it as destination for the moving entity. So far so good ...
But I have to set many path nodes in WED so that the destination isn't that far away from the mouse position ...
In most cases the mouse position is between two nodes ... as we do not take care of the height we can see it like a triangle, right?
One side would be the connection of the two nodes and the two other sides would be the connection from the mouse position to the two nodes.
As I don't want the moving entity to leave the path itself, I'd like to move the mouse position point onto the connection line of the two nodes, so that it lies between the two nodes ... I hope you can follow me (hard to describe).
Can anybody help me how to calculate that ... I have the coordinates of the mouse position when clicked and I have the coordinates of the two nodes ... how to move the mouse position so that it lies on the line between the two nodes ???
Best regards,
Pegamode.