I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have the center.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector.
Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of your circle, to get vector CB. Finally, add CB to your center coordinates to get the coordinates of B.
B = Normalize(APos - CenterPos) * Radius BPos = CenterPos + B