Non-uniform scaling of mesh collider - Unity ECS physics

Hello, how can I non-uniformly scale MeshCollider in Unity ECS Physics? I was following Physics samples nr. 9. - Modify/Modify - Runtime Collider/Modify and the only relevant code I found is the one below:

float3 oldSize = 1.0f;
float3 newSize = 1.0f;
unsafe
{
    // grab the box pointer
    BoxCollider* bxPtr = (BoxCollider*)collider.ColliderPtr;
    oldSize = bxPtr->Size;
    newSize = math.lerp(oldSize, size.Target, 0.05f);

    // if we have reached the target size, get a new target
    float3 newTargetSize = math.select(size.Min, size.Max, size.Target == size.Min);
    size.Target = math.select(size.Target, newTargetSize, math.abs(newSize - size.Target) < new float3(0.1f));

    var boxGeometry = bxPtr->Geometry;
    boxGeometry.Size = newSize;
    bxPtr->Geometry = boxGeometry;
}

Problem is that this code non-uniformly scales BoxCollider, whereas I would need to scale MeshCollider, which doesn’t have Size property. Is there a way to achieve this?

Thanks in advance for your answers!

1.3.0-exp.1 introduced Collider.BakeTransform which can apply a local transformation including non-uniform scale.

  • New Collider.BakeTransform function which allows deforming a collider at runtime. This function is implemented for all collider types except the TerrainCollider and applies a provided affine transformation to the collider geometry, rotating, translating, scaling and shearing it accordingly. The geometric transformation will be either perfect for mesh types, or approximate for primitives. Specific deformations will be perfect even for primitives depending on the type of deformation and the primitive’s parametrization. As such a BoxCollider with identity orientation in local space will be uniformly scaled, updating its width, height and length perfectly, if the provided affine transformation is a pure scaling matrix.