Needed help with math

  1. What do you want to achieve? I suck at math stuff. I’m learning. Okay I’m working on a progress circular ui and these parts in folder if you see the video in gyazo. I’m trying to script the distance from character and once your character are nearby to one number part, then it moves next to two number part.

  2. Video https://gyazo.com/e46b5aefbd3e1846563da1e3ec9301dc

  3. What solutions have you tried so far? How I can make a progression? it helped little.

I’m not quite experienced with UI, so there might be another way to do this.

Yet for the progress circular UI due to Roblox Studio not being so flexible with UI there’s a good website that does it for you, so you’ll simply have to change the image based on the rate you set.

  • The tradeoff being that depending on how smooth you want it to be, the more images required and consequently more work (somewhat)

For the distance script, you’ll need to check for the parts’ magnitude, relative to the player, here’s a good starting source: Getting Magnitude. And later when the part is a determined distance from the player, you change its position

Note: consider the magnitude as a distance measured in studs

1 Like

You don’t even need a spritesheet as suggested above. Default ProximityPrompts achieve a radial progress bar by “splitting” (using ClipsDescendants) a generic hollow circle in half and revealing it using UIGradients which is pretty smart, though you bear any expense of in-house 2D rendering.

You can look at the code and mock how it’s done there for your own use case. ProximityPrompt.

2 Likes

I think this is dumb, but you can calculate the magnitude between start and end point, and subtract the magnitude between player and end point from magnitude between start and end point.

Now use this formula to calculate the rotation angle -
m2/m1 × 360

m2 = magnitude between player and end point
m1 = magnitude between start and end point

Then use the result to rotate the UI