# LibGDX/Java - Trying to find the vector from one object to another

I want to add springs in my game that work like the ones in sonic - i.e. if you can't get over an obstacle you have to hit a spring which sends the main character flying towards another spring that gets him over that obstacle. I drew a little diagram below to demonstrate what I mean (yellow arrows represent the direction the player will go towards and the red - are the springs).

In my Spring class I have created a method:

//The detection area (blue rectangle in the diagram)
}


If the Player collides with a Spring, I check to see if there's ANOTHER Spring within the blue area and if there is - calculate the vector that takes you towards that spring and send the player in that direction.

This seems like a very simple concept which has probably been done loads of times before, but I couldn't find any good examples online for some reason. Does anybody know how I can get the vector I need?

Any insight is highly appreciated, thanks.

• Rather than detecting another spring in a vicinity, it would be easier to simply manually link the 2 springs together as they're static entities on the map. – d3dave Mar 8 '15 at 0:05