Skip to main content
2 of 3
added 219 characters in body; added 3 characters in body
Sean Carey
  • 694
  • 6
  • 14

How to know if a rigidbody2D is moving away or towards another position?

I want to know if the rb2D is moving away or towards the other position. The rb2D could be traveling anywhere along the x and y axis. So assume the other position is a vertical line running down the center of the screen. Unless the rb2D is just bouncing up and down (which it isn't), it's either going to be moving towards or away from the other position. Is there a formula to determine this?

Sean Carey
  • 694
  • 6
  • 14