Hi @Ben,
I looked into the Spatial Contact Force block in Simscape Multibody and here’s what I found regarding your questions.
How the time derivative of penetration depth (dot d) is computed
Feedback: The documentation calls it “the first time derivative of the penetration depth,” meaning how fast the two objects are moving relative to each other along the contact direction.
What’s missing: The docs don’t explain exactly how Simscape calculates it internally. So,I don’t know if it’s based on the relative velocity at the contact point, a numerical difference of the penetration depth over time, or some other method.
The smoothing function
Feedback: The block uses a smoothing function to make the force increase gradually as the objects start to touch. The documentation says:
- The function is 0 when objects are just touching, and 1 when penetration reaches the transition width.
- It increases smoothly and continuously.
- Its slope is zero at the start and end (so the force doesn’t jump abruptly).
What’s missing:* The documentation never gives the actual formula,which means you will only know the general behavior, not the exact math.
What you can do
Feedback: Contact MathWorks support to ask for the exact smoothing function and how the derivative is calculated — sometimes they can provide internal notes.If you just need something to test with, you can create your own smooth function that meets the same behavior (like a simple curve that goes from 0 to 1 smoothly).
*You can also log the penetration depth in your simulation and calculate its rate of change yourself
If you want full control, you can build a custom force function in Simscape or Simulink and define both the smoothing and the derivative yourself.
Also, I checked archived manuals from older versions of Simscape, and they repeat the same explanations, but still don’t show the exact formula or computation method.
Hope this helps.