stride3d/stride · error · Exception

ContinuousCollisionDetection must be enabled at physics…

Error message

ContinuousCollisionDetection must be enabled at physics engine initialization using the proper flag.

What it means

The ContinuousCollisionDetection getter on Stride's Simulation only works if the underlying physics engine (Bullet) was initialized with the CCD flag. If CanCcd is false (PhysicsEngineFlags.ContinuousCollisionDetection not set in the configuration), reading the property throws because the feature is unavailable in this simulation instance.

Solutions

  1. Set PhysicsEngineFlags.ContinuousCollisionDetection in the PhysicsConfiguration flags BEFORE the physics engine/Simulation is created
  2. Check CanCcd before accessing the property and skip CCD configuration if unavailable
  3. Reconfigure the physics engine initialization code (e.g. in the scene's physics settings or Simulation creation) and restart the application

Example fix

// before
var simulation = this.GetSimulation();
simulation.ContinuousCollisionDetection = true; // throws if flag unset
// after
var config = new PhysicsConfiguration { Flags = PhysicsEngineFlags.ContinuousCollisionDetection };
var simulation = new Simulation(this, config);
simulation.ContinuousCollisionDetection = true;
Defensive patterns

Strategy: validation

Validate before calling

if (simulation.CanCcd)
{
    var ccd = simulation.ContinuousCollisionDetection;
}
else
{
    // CCD not enabled at initialization
}

Try / catch

try
{
    var ccd = simulation.ContinuousCollisionDetection;
}
catch (Exception ex) when (ex.Message.Contains("ContinuousCollisionDetection"))
{
    // fall back: CCD unavailable, use smaller timestep
}

Prevention

When it happens

Trigger: Reading the Simulation.ContinuousCollisionDetection property when the Simulation was created with a PhysicsConfiguration whose Flags do not include PhysicsEngineFlags.ContinuousCollisionDetection.

Common situations: Enabling CCD in a game component or script at runtime without having set the flag at engine initialization; default project templates that don't pass the CCD flag to the physics engine.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Physics/Simulation.cs:52

        private readonly BulletSharp.DispatcherInfo dispatchInfo;

        private SimulationTickEvent preSimulationTick, postSimulationTick;

        internal readonly bool CanCcd;

        private float carriedDelta;

#if DEBUG
        private static readonly Logger Log = GlobalLogger.GetLogger(typeof(Simulation).FullName);
#endif

        public bool ContinuousCollisionDetection
        {
            get
            {
                if (!CanCcd)
                {
                    throw new Exception("ContinuousCollisionDetection must be enabled at physics engine initialization using the proper flag.");
                }

                return dispatchInfo.UseContinuous;
            }
            set
            {
                if (!CanCcd)
                {
                    throw new Exception("ContinuousCollisionDetection must be enabled at physics engine initialization using the proper flag.");
                }

                dispatchInfo.UseContinuous = value;
            }
        }

        /// <summary>
        /// Totally disable the simulation if set to true
        /// </summary>

View on GitHub (pinned to 96fad776d2)