stride3d/stride · error · NotImplementedException

Collider type is missing in , please fill an issue or fix it

Error message

Collider type {collider.GetType()} is missing in {nameof(GetLocalTransforms)}, please fill an issue or fix it

What it means

CompoundCollider.GetLocalTransforms switches over known collider kinds (box, capsule, cylinder, sphere, triangle, convex hull) to build per-child shape data; any other collider type hits the default case and throws NotImplementedException. This indicates a collider type was added to the library without updating compound-shape handling — an internal coverage gap.

Solutions

  1. Replace the unsupported child collider with a supported type (Box, Sphere, Capsule, Cylinder, Triangle, ConvexHull).
  2. Update Stride.BepuPhysics / Stride to matching versions so all built-in collider types are handled.
  3. If it's your custom collider, extend CompoundCollider.GetLocalTransforms (or file/fix the issue as the message says).

Example fix

// before
compound.Children.Add(myCustomCollider); // unhandled type
// after
compound.Children.Add(new ConvexHullCollider(myCustomCollider.Points)); // supported type
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<Type> Supported = new() { typeof(BoxCollider), typeof(SphereCollider), typeof(CapsuleCollider), typeof(CylinderCollider), typeof(TriangleCollider), typeof(ConvexHullCollider) };
if (children.Any(c => !Supported.Contains(c.GetType()))) throw new InvalidOperationException("Compound contains unsupported collider type");

Try / catch

try { var compound = BuildCompound(children); } catch (NotImplementedException ex) { log.Error("Unsupported collider in compound", ex); /* rebuild with supported types */ }

Prevention

When it happens

Trigger: Building a CompoundCollider whose Children list contains a collider type not handled by the switch (e.g. a new/custom ICollider implementation, or a newer Stride collider type used with an older Stride.BepuPhysics build).

Common situations: Using a custom collider subclass with compounds, upgrading Stride so new collider types exist but the physics plugin is stale, or mistakenly placing a non-convex/non-supported collider into a compound.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/e43cf61aec7e73fd. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.BepuPhysics/Stride.BepuPhysics/Definitions/Colliders/CompoundCollider.cs:63

        _colliders = new() { Owner = this };
    }

    public void GetLocalTransforms(CollidableComponent collidable, Span<ShapeTransform> transforms)
    {
        for (int i = 0; i < _colliders.Count; i++)
        {
            var collider = _colliders[i];
            transforms[i].PositionLocal = collider.PositionLocal;
            transforms[i].RotationLocal = collider.RotationLocal;
            transforms[i].Scale = collider switch
            {
                BoxCollider box => box.Size,
                CapsuleCollider cap => Vector3.One,
                CylinderCollider cyl => new(cyl.Radius, cyl.Length, cyl.Radius),
                SphereCollider sph => new(sph.Radius),
                TriangleCollider tri => Vector3.One,
                ConvexHullCollider convex => Vector3.One,
                _ => throw new NotImplementedException($"Collider type {collider.GetType()} is missing in {nameof(GetLocalTransforms)}, please fill an issue or fix it"),
            };
        }
    }

    bool ICollider.TryAttach(Shapes shapes, BufferPool pool, ShapeCacheSystem shapeCache, bool shouldCalculateInertia, out TypedIndex index, out Vector3 centerOfMass, out BodyInertia inertia)
    {
        if (_colliders.Count == 0)
        {
            index = default;
            centerOfMass = default;
            inertia = default;
            return false;
        }

        var compoundBuilder = new CompoundBuilder(pool, shapes, _colliders.Count);
        try
        {
            foreach (var collider in _colliders)

View on GitHub (pinned to 96fad776d2)