I have a static object. I have a moving player.
If the player is moving directly towards the object then I want to return the value of 1. If the player is moving directly away from the the object then I want to return the value of 0. If the player is moving somewhat between these two directions then I want to return a value proportionally relevant to the two previously mentioned values - between 0 and 1 depending on the direction. The direction that the player is facing is irrelevant, it's the velocity of the player that's important for my situation.
How do I calculate this value?
This is so frustrating, as I know that I've solved this exact problem in the past but I'm currently drawing a blank. It involves some trig and some dot product, but for now I'm clueless and would appreciate any help that's offered.