internal static void SetBakedCylinderSize(this PhysicsShapeAuthoring shape, float height, float radius, float bevelRadius) { var cylinder = shape.GetCylinderProperties(out EulerAngles orientation); var center = cylinder.Center; var bakeToShape = BakeCylinderJob.GetBakeToShape(shape, center, orientation); var scale = bakeToShape.DecomposeScale(); var newRadius = radius / math.cmax(scale.xy); if (math.abs(cylinder.Radius - newRadius) > kMinimumChange) { cylinder.Radius = newRadius; } if (math.abs(cylinder.BevelRadius - bevelRadius) > kMinimumChange) { cylinder.BevelRadius = bevelRadius; } var newHeight = math.max(0, height / scale.z); if (math.abs(cylinder.Height - newHeight) > kMinimumChange) { cylinder.Height = newHeight; } shape.SetCylinder(cylinder, orientation); }