I am attempting to create “pointers” that direct players to the corresponding limb from their respective slots in my inventory GUI. A little trigonometry and WorldToViewportPoint gives me the correct orientation and end position of each pointer, but it seems that there is something I am missing about AbsoluteSize and AbsolutePosition:
To clarify, I want each pointer to begin at the center of its inventory slot and end at its limb. However, I am having trouble finding a way to calculate the center of each slot. The following variable is what represents the origin of each pointer:
local origin = slot.AbsolutePosition + slot.AbsoluteSize / 2;
I should note that the slot’s top-left corner does not start at the label above the slot. The blue box represents the slot object’s bounds and its anchor point (.5, .5
):
One last thing I should mention is that all the slots are stored in an invisible frame containing a UIAspectRatioConstraint with a ratio of 1
to make it square and fit as much of the screen as possible. This frame’s anchor point is also .5, .5
, and its position is {.5, 0}, {.5, 0}
.
I’m aware that my question may be similar to something previously posted, but none of them involved a parent GUI with a constraint to my knowledge. Any help or advice is greatly appreciated!