public static IEnumerable <HkShape> GetAllShapes(this HkShape shape)
        {
            if (shape.IsContainer())
            {
                var iterator = shape.GetContainer();
                while (iterator.CurrentShapeKey != HkShape.InvalidShapeKey)
                {
                    foreach (var child in iterator.CurrentValue.GetAllShapes())
                    {
                        yield return(child);
                    }

                    iterator.Next();
                }

                yield break;
            }

            yield return(shape);
        }
        public static float GetConvexRadius(this HkWorld.HitInfo hitInfo)
        {
            if (hitInfo.Body == null)
            {
                return(0);
            }

            HkShape shape = hitInfo.Body.GetShape();

            for (int i = 0; i < HkWorld.HitInfo.ShapeKeyCount; i++)
            {
                var shapeKey = hitInfo.GetShapeKey(i);
                if (HkShape.InvalidShapeKey != shapeKey)
                {
                    if (!shape.IsContainer())
                    {
                        break;
                    }
                    //shape = shape.GetContainer().GetShape(shapeKey);
                }
                else
                {
                    break;
                }
            }
            if (shape.ShapeType == HkShapeType.ConvexTransform || shape.ShapeType == HkShapeType.ConvexTranslate || shape.ShapeType == HkShapeType.Transform)
            {
                shape = shape.GetContainer().GetShape(0);
            }
            if (shape.ShapeType == HkShapeType.Sphere || shape.ShapeType == HkShapeType.Capsule)
            {
                return(0);
            }
            if (!shape.IsConvex)
            {
                return(HkConvexShape.DefaultConvexRadius);
            }

            return(shape.ConvexRadius);
        }