Skip to content

Commit a17285a

Browse files
committed
reset also the fixed rest positions
1 parent 0e89471 commit a17285a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/BeamAdapter/component/controller/InterventionalRadiologyController.inl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,14 +1117,17 @@ template <class DataTypes>
11171117
void 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
}

0 commit comments

Comments
 (0)