I’m doing a computer interface. There is a mode where you can switch between a 2D view (you only see the interface) or a 3D view (you see the interface but from your camera, like a SurfaceGui). Unfortunately, I cannot use the Scale option at all since the programs in said interface are draggable using a custom module, which uses, yes, offset. I can call a function to loop through all the programs to update their positions based on the parent frame (is always full-sized, whether its for a Surface or a ScreenGui), but what is the math calculus that takes care of said position?
You’d need to multiply the position and size by the ratio of the new axis size to the old axis size. Something like this should work.
newPosition = Udim2.new(0, originalXOffset * (newXSize / oldXSize), 0, originalYoffset * (newYSize / oldYSize))
Hold on a second, could you explain please what the old/new sizes represent? AbsoluteSizes before and after of the parent frame?
Yes, the absolutesizes of the parent frame.
And OriginalOffset would be… the offset of that particular axis before the mode changed?
Well apparently so:
With this line of code:
Program.Position = UDim2.fromOffset(Program.Position.X.Offset * (Programs.AbsoluteSize.X / OldProgramsSize.X), Program.Position.Y.Offset * (Programs.AbsoluteSize.Y / OldProgramsSize.Y))
Thank you very much kind sir
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.