Math equation for new shoulder position

I am not good with math like most people and I have been trying to figure out the new shoulder position for my player’s character for 2 days (on the 3rd day now) and I just can’t figure it out.
The information I have to calculate this new position is the players new arm size (value can be anywhere from 0.5 to 1),
at first I thought it would be simple by doing

--[[
I am looping thru the character so "v" would be the current part I am looping thru
"change" is the new arm size, so it will always be between 0.5 and 1
]]
if v.Name == "Right Arm" then
	local motor = char.Torso["Right Shoulder"]
	motor.C0 = CFrame.new(change, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))
elseif v.Name == "Left Arm" then
	local motor = char.Torso["Left Shoulder"]
	motor.C0 = CFrame.new(-change, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(-90), math.rad(0))
end

but the problem with this is that there is still a weird offset to the shoulder position, here is a image of the problem with the arm size being 0.5
image
(Its hard to see because my avatar is all white, but there is a slight shadow)
So how could I avoid this?

After asking AI hundreds of times it eventually gave me an answer, which looks something like this

motor.C0 = CFrame.new((1-.75)*(change-.5)/(1-.5) + 0.75, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))

which works perfectly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.