AbsolutePosition inconsistency for children of constrained GUI objects

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):

image

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!

1 Like

I measured the offset to be 36 pixels, which is consistent with the CoreGui topbar height.
This sounds like a problem with .IgnoreGuiInset

1 Like

Oh… I should have looked into that now that you bring it up. I originally discarded the possibility because I have the topbar disabled and IgnoreGuiInset set to true. I’ll find out what exactly I’m failing to realize and keep everyone posted.

After a few moments of thinking, I’m assuming it’s because AbsolutePosition remains constant regardless of the state of the topbar or whether or not IgnoreGuiInset is set to true or false. This means that AbsolutePosition always assumes the GUI respects the topbar’s inset.

Here I have a frame at position {0, 0} {0, 0} that has an AbsolutePosition of 0, -36 solely because its ScreenGui ancestor ignores inset:

imageimageimage

Perhaps Roblox should consider adjusting AbsolutePosition values for GUI elements that ignore inset. Not sure if this has been brought up before.

2 Likes