public void setAngle(int angle) { angle += 90; if (angle < 90) { platformHeight = -(3.5f / 90) * (angle) + 5.5f; } else { platformHeight = 0; } angle -= 90; Vector2 initialPos; initialPos.x = FindObjectOfType <HandMove>().transform.position.x + arm * Mathf.Cos(angle * Mathf.Deg2Rad); initialPos.y = platformHeight + initialY + arm * Mathf.Sin(angle * Mathf.Deg2Rad); this.angle = angle; platform.setHeight(platformHeight); Vector3 pos = transform.position; float x = (pos.x - initialPos.x); float theta = angle * Mathf.Deg2Rad; pos.y = calculateHeight(x, theta, initialPos); transform.position = pos; mainPos = pos; angleText.text = (angle + 90).ToString() + " درجه"; }