Cylinder bevel radius cannot be larger than the cylinder

On relatively thin cylinders (radius ~3mm-1cm, 1m = 1unit), when I add a Cylinder PhysicsShape, and Fit To Enabled Render Meshes, then the following is thrown:

ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Cylinder bevel radius cannot be larger than the cylinder
Unity.Physics.CylinderGeometry.Validate () (at Library/PackageCache/com.unity.physics@0.2.5-preview.1/Unity.Physics/Collision/Colliders/CylinderCollider.cs:85)

Here:

            if (m_BevelRadius > m_Radius || m_BevelRadius * 2 > m_Height)
            {
                throw new ArgumentOutOfRangeException("Cylinder bevel radius cannot be larger than the cylinder");
            }

“Fit To Enabled Render Meshes” should probably not generate ArgumentOutOfRangeException, which is why I think this is a bug. It should probably generate a bevel radius that does not violate m_BevelRadius > m_Radius || m_BevelRadius * 2 > m_Height, and if not useful, emit a warning.

Thanks for posting, we’ll get it fixed

1 Like

Thank you! :slight_smile: