Adding projective constraints mid-simulation #2718
-
I would like to know if it's possible to add a constraint mid-simulation. x = node.mechanical_object.position.value[i]
node.addObject('LinearMovementConstraint`, indices=[i], relativeMovements=True, movements=[*x, x[0] + 1, ...], ...) This, or change the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello @ateixeira0163 |
Beta Was this translation helpful? Give feedback.
-
I would go for a python3 controller which would add dynamically a LinearMovementConstraint in your node and accessing the MechanicalObject to get the current object position and define the key movements. Have you succeeded to implement your idea? |
Beta Was this translation helpful? Give feedback.
Hello @ateixeira0163
I would not answer for all the Constraints in SOFA (because it depends on the implementation, etc) but for
LinearMovementConstraint
it seems the code does not do precomputing/caching/buffering so if the data are changing while simulating, it should be taken into account.And this component is not very complex so I guess adding it into the scene in a middle of simulation should be possible IMO.