diff --git a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl index 5a21797c4..04aaeca2c 100644 --- a/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl +++ b/src/BeamAdapter/component/controller/InterventionalRadiologyController.inl @@ -1121,14 +1121,21 @@ void InterventionalRadiologyController::fillInstrumentCurvAbsTable(co template void InterventionalRadiologyController::fixFirstNodesWithUntil(unsigned int firstSimulatedNode) { + l_fixedConstraint->clearConstraints(); + + if (firstSimulatedNode == 0) + { + msg_warning() << "An invalid value of firstSimulatedNode equal to 0 has been given to fixFirstNodesWithUntil() method."; + d_indexFirstNode = 0; + return; + } + WriteAccessor > xMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::position); WriteAccessor > xrestMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::restPosition); WriteAccessor > vMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::velocity); // set the position to startingPos for all the nodes that are not simulated const auto& startPos = d_startingPos.getValue(); - // and add a fixedConstraint - l_fixedConstraint->clearConstraints(); for(unsigned int i=0; i