return function(B,G,R,p,r)debug.profilebegin("\083\112\114\105\110\103 \067\111\110\115\116\114\097\105\110\116")local c=p.Settings local j=c.Stiffness local y=c.Elasticity local W=p.Bones[B.ParentIndex]if W then local p=B.FreeLength if j>0 or y>0 then local c=CFrame.new(W.Position)*W.TransformOffset.Rotation R=R or(c*CFrame.new(B.LocalTransformOffset.Position)).Position local l=R-G G+=l*(y*r)if j>0 then local B=R-G local r=B.Magnitude local c=(p*(1-j))*2 if r>c then G+=B*((r-c)/r)end end end local c=W.Position-G local l=c.Magnitude if l>0 then G+=c*((l-p)/l)end end debug.profileend()return G end
--!native
return function(self, Position, RestPosition, BoneTree, Delta)
	debug.profilebegin("Spring Constraint")

	local Settings = BoneTree.Settings
	local Stiffness = Settings.Stiffness
	local Elasticity = Settings.Elasticity

	local ParentBone = BoneTree.Bones[self.ParentIndex]

	if ParentBone then
		local RestLength = self.FreeLength

		if Stiffness > 0 or Elasticity > 0 then
			local ParentBoneCFrame = CFrame.new(ParentBone.Position) * ParentBone.TransformOffset.Rotation
			RestPosition = RestPosition or (ParentBoneCFrame * CFrame.new(self.LocalTransformOffset.Position)).Position

			local ElasticDifference = RestPosition - Position
			Position += ElasticDifference * (Elasticity * Delta)

			if Stiffness > 0 then
				local StiffDifference = RestPosition - Position
				local Length = StiffDifference.Magnitude
				local MaxLength = RestLength * (1 - Stiffness) * 2
				if Length > MaxLength then
					Position += StiffDifference * ((Length - MaxLength) / Length)
				end
			end
		end

		local Difference = ParentBone.Position - Position
		local Length = Difference.Magnitude
		if Length > 0 then
			Position += Difference * ((Length - RestLength) / Length)
		end
	end
	debug.profileend()

	return Position
end
