I'm trying to make an arrow icon on the screen rotate point to a specific UDim2, but I'm not sure how to go about it.
✓ ANSWER ACCEPTED
How would I go about making a GUI object rotate to point towards a UDim2?
1 answer
✓ Accepted answer
Some interesting math.
arrow=script.Parent
arrow_center=arrow.AbsolutePosition+arrow.AbsoluteSize/2 --grab center position of the image
spot=UDim2.new(0, 76, 0, 72) --Best if offset is used in this case
new_spot=Vector2.new(spot.X.Offset-arrow_center.X, spot.Y.Offset-arrow_center.Y) --Make the arrow act like point 0
c=math.deg(math.atan2(new_spot.Y, new_spot.X))+0 --Add or remove according on which direction the arrow is facing in the original picture. If the arrow was originaly pointing to the right then you should be fine.
arrow.Rotation=c
This discussion is preserved as it was. New answers, comments, and votes are closed.
