New answers tagged


I'll use vector notation to be concise. You can translate this into individual vectorX and vectorY numbers if you're not using a vector math library, just be careful to calculate the length below using both components. // Get a vector pointing into the planet. Vector offset = planetPosition - playerPosition; // Note that x & y aren't separable: // you ...

Top 50 recent answers are included