private void ApplyBarrelRollTemplateLimits() { Vector3 newPosition = TheShip.InverseTransformPoint(BarrelRollTemplate.transform.position); Vector3 fixedPositionRel = newPosition; fixedPositionRel.x = HelperDirection * templateWidth; fixedPositionRel.z = Mathf.Clamp(fixedPositionRel.z, -0.75f * TheShip.ShipBase.SHIPSTAND_SIZE, -0.25f * TheShip.ShipBase.SHIPSTAND_SIZE); Vector3 fixedPositionAbs = TheShip.TransformPoint(fixedPositionRel); BarrelRollTemplate.transform.position = fixedPositionAbs; }