Math help with rotated UI

Hello!

I’m giving users an option to open a menu, but said menu is somewhat hard to see, especially when people are first joining, so my idea was to create an arrow as a tutorial. The problem is that I want to use a rotated arrow as an indicator and said arrow should have a sort of nudging motion. The problem is that I’m not sure how to go about moving it based on the rotation of the arrow.

So as you can tell from this screenshot, the arrow is rotated to -112º, so how would I go about moving it along the axis that it’s rotated on? The black line is roughly the path I want it to follow.
Screen Shot 2021-09-29 at 9.09.30 PMScreen Shot 2021-09-29 at 9.10.43 PM

1 Like

You should just be able to break the direction down into its x and y components using cos and sin

local nudge = pos + UDim2.new(0,math.cos(math.rad(angle)) * distance, 0, math.sin(math.rad(angle)) * distabce)

(You might have to add on an angle to the angle, unless the arrow is facing straight right with an angle of 0 youll need to adjust)

3 Likes

It was facing right luckily, I got it from Icons8 which had it facing right which is just my luck I suppose haha. Thanks!

2 Likes

ik there is a solution already, but I wanted to tell you about this typo

3 Likes