internal static void SetBakedSphereRadius(this PhysicsShapeAuthoring shape, float radius) { var sphere = shape.GetSphereProperties(out EulerAngles eulerAngles); var center = sphere.Center; radius = math.abs(radius); var basisToWorld = GetBasisToWorldMatrix(shape.transform.localToWorldMatrix, center, eulerAngles, 1f); var basisPriority = basisToWorld.HasShear() ? GetBasisAxisPriority(basisToWorld) : k_DefaultAxisPriority; var bakeToShape = GetPrimitiveBakeToShapeMatrix(shape.transform.localToWorldMatrix, shape.GetShapeToWorldMatrix(), ref center, ref eulerAngles, 1f, basisPriority); var scale = math.cmax(bakeToShape.DecomposeScale()); var newRadius = radius / scale; sphere.Radius = newRadius; shape.SetSphere(sphere); }