internal static void SetBakedCapsuleSize(this PhysicsShapeAuthoring shape, float height, float radius) { var capsule = shape.GetCapsuleProperties(); var center = capsule.Center; var bakeToShape = BakeCapsuleJob.GetBakeToShape(shape, center, capsule.OrientationEuler); var scale = bakeToShape.DecomposeScale(); var newRadius = radius / math.cmax(scale.xy); if (math.abs(capsule.Radius - newRadius) > kMinimumChange) { capsule.Radius = newRadius; } height /= scale.z; if (math.abs(math.length(capsule.Height - height)) > kMinimumChange) { capsule.Height = height; } shape.SetCapsule(capsule); }