28 August 2019 at 18 h 44 min #14166
I’m trying to create a scene in Python where an instrument enter in collision with another object by following a predetermined path. I am using Discrete Intersections and the LinearMovementConstraint component to control the trajectory of the instrument.
However, the collision response doesn’t work. The intersections seems to be drawn correctly in the GUI but the objects just passe right through each other. Although, when the objects are pulled against each other with the mouse, the collisions work fine.
Any idea why it’s not working? I tried to include a code example within this message but I always get the “*** Forbidden. Message seems to be spam. ***” message when trying to submit.
Francois2 September 2019 at 17 h 03 min #14176
Could you share your scene with us? (link to a github/wetransfer ..)
Since you are imposing the displacement (using the LinearMovementConstraint), the simulation will make sure this constraint is respected even if the object collides with others. Therefore the result is logical and it is working properly.
To work what you expect, a solution to impose the displacement on the rest_position and to add a RestShapeSpringForceField. But it’s hard to give appropriate advices without seeing your simulation.
Hugo10 September 2019 at 22 h 01 min #14226
The displacement is only imposed on one object. I don’t understand why the other object doesn’t deform or get pushed by it. I will try the RestShapeSpringForceField to see what it does.
Meanwhile, I’ve put a simplified scene here.
Francois13 September 2019 at 19 h 43 min #14236
I do not advise to use DiscreteIntersection for the detection but rather the LocalMinDistance (or MinProximityIntersection) as shown below:
self.rootNode.createObject("LocalMinDistance", name="Intersection", alarmDistance="0.3", contactDistance="0.1", useLMDFilters="0")
Hugo30 September 2019 at 22 h 07 min #14321
Sorry for the late reply. Why do you not advise to use DiscreteIntersection? In my scene, many objects are very close to each other. With proximity intersections, I haven’t been able to set the contact distance small enough so that the objects are not in collision from the start and yet have realistic looking collisions.
Also, how can I impose a displacement on the rest_position?
Francois1 October 2019 at 9 h 37 min #14322
No prob. LocalMinDistance actually inherits from DiscreteIntersection but has a more complete implementation (e.g. of all intersections between discrete primitives to compute). You can see this here in the API doc.
If your objects are not in contact, you should be able to find a value of alarm and contact distance which satisfies your expectations.
What do you mean by imposing a displacement on the rest_position? Do you want to keep the same position but to have shifted rest_position? or do you want to shift the object at initialization of the scene ?
Hugo2 October 2019 at 0 h 18 min #14334
I will try again with LocalMinDistance.
For the rest_position, I was referring to your previous suggestion to impose the displacement on the rest_position and to add a RestShapeSpringForceField, rather then using LinearMovementConstraint. With what component can I do that?
François7 October 2019 at 15 h 10 min #14354
To work with the approach involving the RestShapeSpringForceField, you could simply pass these rest positions to the MechanicalObject at the init (from a loader) like :
<MeshObjLoader name="undeformed" filename="mesh1.obj"/> <MeshObjLoader name="deformed-targetConfiguration" filename="mesh2.obj"/> <MechanicalObject name="Dofs" position="@undeformed.position" rest_position="@deformed-targetConfiguration.position" /> <RestShapeSpringForceField />
You must be logged in to reply to this topic.