UiCorner CornerRadius calculation

Hi, I’m currently working on a plugin that works with the CornerRadius calculation. How do I calculate the minimum CornerRadius in Scale for the gui to become a pill shape?

I can’t find any information regarding this anywhere, help is appreciated!

i dont even think you need to calculate this
the minimum to reach a pill shape is 0.5

1 Like

Yeah, just did trial and error and found this out :stuck_out_tongue:

Thanks!

For future reference, the scale parameter is a fraction of the shortest edge, in the solution example that’s the top edge. So 0.25 would make the corner radii equal to 25% the length of the short edge. For a semi-circle you want the radius to be half (50%) of the short edge to make the diameter 100% of the short edge, hence the 0.5 scale.

If the scale + offset add up to more than half the short edge, it essentially ignores it and clamps the radius at 50% of the short edge otherwise the corners would overlap.

Hopefully that avoids you needing to do trial and error for any future corner needs!

2 Likes