angle = transform.yRotation%360; minAngle = 100; maxAngle = 120; mid = (maxAngle+minAngle)/2; if (angle < mid) linear(angle,minAngle,mid,0,100) else linear(angle,mid,maxAngle,100,0)