File tree Expand file tree Collapse file tree
src/BeamAdapter/component/controller Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1117,14 +1117,17 @@ template <class DataTypes>
11171117void InterventionalRadiologyController<DataTypes>::fixFirstNodesWithUntil(unsigned int firstSimulatedNode)
11181118{
11191119 WriteAccessor<Data<VecCoord> > xMstate = *getMechanicalState ()->write (sofa::core::vec_id::write_access::position);
1120+ WriteAccessor<Data<VecCoord> > xrestMstate = *getMechanicalState ()->write (sofa::core::vec_id::write_access::restPosition);
11201121 WriteAccessor<Data<VecDeriv> > vMstate = *getMechanicalState ()->write (sofa::core::vec_id::write_access::velocity);
11211122
11221123 // set the position to startingPos for all the nodes that are not simulated
1124+ const auto & startPos = d_startingPos.getValue ();
11231125 // and add a fixedConstraint
11241126 l_fixedConstraint->clearConstraints ();
11251127 for (unsigned int i=0 ; i<firstSimulatedNode-1 ; i++)
11261128 {
1127- xMstate[i]=d_startingPos.getValue ();
1129+ xMstate[i] = startPos;
1130+ xrestMstate[i] = startPos;
11281131 vMstate[i].clear ();
11291132 l_fixedConstraint->addConstraint (i);
11301133 }
You can’t perform that action at this time.
0 commit comments