local MATH = {}
function round(x)
return x + 0.5 - (x + 0.5) % 1
end
function MATH:Normalize(x, A, B, C, D) -- (A, B) - The minimum and maximum values in the current range. (C, D) - The minimum and maximum values of the desired range. (x) - The current value in the current range.
local Normal = (x - A)*(D - C)/(B - A)
return round(Normal/0.01)*0.01
end
return MATH
I have a slider that determines the speed and rotation of the camera in game. To read this input I normalize the values to 0, 1 range.
When the GUI's normalized position is at 0.5 the Camera should come to a full stop.
The problem is, in order to center the position of the slider the offset of the slider on the X axis needs to be set to 1/2 of the slider's absolute size.
On the Ipad mini, the GUI's Absolute Size is 77. So to center the slider the slider's offset on the X axis will be 77/2. The problem begins with the fact that offset does not accept anything other than a whole number.
Because of this, the normalized center for the slider on the Ipad mini is 0.48.
I need a way to ensure that the normalized center is always 0.5.
Is this at all possible?
-- This determines the speed and direction of the camera's rotation
MATH:Normalize(Slider.Position.X.Offset, 0, Slider.AbsoluteSize.X, 0, 1)
~ Thanks, AZDev

3 comments
ROBLOX doesn't let you position things at half pixels, no. What exactly do you need?
I need the camera to rotate based on the position of the slider. Basically at 0 the camera is rotating left. At 0.5 the camera is not rotating and at 1 the camera is rotating right. The position of the slider also determines the speed of the camera's rotation. At 0 the camera is rotating left in increments of -0.1. @BlueTaslem
I found a different approach to my problem which works great.