# How to use Multibody.jl?

**URL:** <https://discourse.julialang.org/t/how-to-use-multibody-jl/134354>\
**Category:** Modelling & Simulations\
**Created:** [December 4, 2025, 10:21am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354 "2025-12-04T10:21:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SietseAchterop](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sietseachterop/32/219565_2.png) [@SietseAchterop](https://discourse.julialang.org/u/SietseAchterop)\
**Post date:** [December 4, 2025, 10:21am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/1 "2025-12-04T10:21:01Z")

</div>

Hello all,  
I am new to Julia, now on version 1.12.2 on Linux/Debian version 13.2.  
Played around with it and with Dyad.  
Now trying to use the Pendulum example from Multibody.jl  
I can do add and then using ModelingToolkit, but adding Multibody fails. Same with JuliaSimCompiler.  
The error is:

```julia-auto
Updating registry at `~/.julia/registries/DyadRegistry.toml`
ERROR: The following package names could not be resolved:
 * Multibody (not found in project, manifest or registry)

```

What am I doing wrong?

Regards, Sietse

PS.  
In Dyad, in Julia-Based Component Libraries there is mentioning of using Multibody.jl.  
It says it could be used using " the `external` components definition".  
But how?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [December 4, 2025, 12:18pm UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/2 "2025-12-04T12:18:02Z")

</div>

Hello and welcome to the community 👋

Multibody.jl used to use an alternative model compiler, JuliaSimCompiler, but this compiler has been deprecated and is no longer functional. The work to make the standard ModelingToolkit compiler handle multibody systems is not yet complete and Multibody.jl is currently not installable or usable. I expect it to take a few months before it’s usable again.

---

<div class="post-metadata">

**Author:** ![SietseAchterop](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sietseachterop/32/219565_2.png) [@SietseAchterop](https://discourse.julialang.org/u/SietseAchterop)\
**Post date:** [December 4, 2025, 4:23pm UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/3 "2025-12-04T16:23:29Z")

</div>

Thanks for the quick reply! Then I’ll wait.

As an aside, in my use case I need contact modeling and friction.  
For example to bounce a ball or drag a box on the ground.

For example opensim/simbody has this.  
Looking at the code of Multibody I see that this isn’t there.  
My hope is to implement something like this, hopefully this is feasible (for me).

Thanks again, Sietse

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [December 5, 2025, 2:30am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/4 "2025-12-05T02:30:07Z")

</div>

Perhaps you’ve seen it already, but a bouncing ball is an example in the MTK docs.

[Event Handling and Callback Functions · ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/basics/Events/#Example:-Bouncing-ball)

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [December 5, 2025, 7:03am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/5 "2025-12-05T07:03:16Z")

</div>

> [@SietseAchterop](#):
>
> As an aside, in my use case I need contact modeling and friction.  
> For example to bounce a ball or drag a box on the ground.
> 
> For example opensim/simbody has this.  
> Looking at the code of Multibody I see that this isn’t there.

As pointed out above, simple events like a ball bouncing off the ground is handled using the standard MTK event machinery. Dragging a box on the ground is slightly more involved, at least if you want to include modeling of static friction, see [Modelica.Mechanics.Rotational.UsersGuide.ModelingOfFriction](https://doc.modelica.org/om/Modelica.Mechanics.Rotational.UsersGuide.ModelingOfFriction.html) for an overview.

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [December 5, 2025, 9:32am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/6 "2025-12-05T09:32:30Z")

</div>

By the way, besides the event-detection based methods for simulation of nonsmooth dynamical systems (which is what the sliding mass exposed to dry friction is), there is a framework of methods based on complementarity constraints (these methods are called, imho rather confusingly, time-stepping methods). As a teaser, here comes my code. Note that it needs a solver for Linear Complemenrarity Problem (LCP) and Mixed Complementarity Problem (MCP) – I am using the PATH solver.

```Julia
using JuMP
using PATHSolver
using Plots

m = 100.0
g = 9.81
μ = 10.0

x0 = 0.0
v0 = 100.0

x = [x0]
v = [v0]

h = 1e-1
tfinal = 5.0
N = tfinal/h

for i = 1:N
    model = Model(PATHSolver.Optimizer)
    set_optimizer_attribute(model, "output", "no")
    set_silent(model)
    @variable(model, ν >= 0)
    @variable(model, F⁺ >= 0)
    @variable(model, F⁻ >= 0)
    @constraint(model, (v[end] + h/m*(F⁺-F⁻) + ν) ⟂ F⁺)
    @constraint(model, (-(v[end] + h/m*(F⁺-F⁻)) + ν) ⟂ F⁻)
    @constraint(model, (μ*m*g - (F⁺+F⁻)) ⟂ ν)
    optimize!(model) 
    push!(v, v[end] + h/m*(value(F⁺)-value(F⁻)))
    push!(x, x[end] + h*v[end]) # At this point, after the update on the prevous line, v[end] already equals v_k+1.
end

t = range(0.0, step=h, stop=tfinal)
Plots.plot(t, v, label="v", lw=3, markershape=:circle, markersize=2)
Plots.plot!(t, x, label="x", lw=3, markershape=:circle, markersize=2, xlabel="t")

```

 ![Position and velocity of a box sliding on a surface with dry friction in response to a nonzero initial velocity](https://global.discourse-cdn.com/julialang/original/3X/c/1/c189e9cf1bad9883f302f3b7be4915bcef9e501f.png)

You can find a bit more in my introductory material [Simulations of complementarity systems using time-stepping – B(E)3M35HYS – Hybrid systems](https://hurak.github.io/hys/10_complementarity/simulations.html). This is example 3 toward the bottom of the page. But it is admittedly very introductory (but links to other literature are included). This type of methods are implemented in simulators such as [SICONOS](https://nonsmooth.gricad-pages.univ-grenoble-alpes.fr/siconos/) and [PINOCCHIO](https://stack-of-tasks.github.io/pinocchio/).

---

<div class="post-metadata">

**Author:** ![Aaron\_Best](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aaron_best/32/213785_2.png) [@Aaron\_Best](https://discourse.julialang.org/u/Aaron_Best)\
**Post date:** [February 6, 2026, 9:47pm UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/7 "2026-02-06T21:47:36Z")

</div>

Hi there! Thanks for answering this question, it was giving me quite the headache! Just wondering if it will be back online anytime soon?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [February 7, 2026, 6:20am UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/8 "2026-02-07T06:20:45Z")

</div>

I expect the next release during the spring, maybe until summer until all pieces are in place, unfortunately I can’t be much more precise than that.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [July 3, 2026, 12:16pm UTC](https://discourse.julialang.org/t/how-to-use-multibody-jl/134354/9 "2026-07-03T12:16:15Z")

</div>

Released. [Docs here](https://help.juliahub.com/dyad/dev/stdlib/MultibodyComponents/home.html). Enjoy a colorful medieval siege weapon simulation:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/4/44e4121d4065b0e291cb192b4d94f547c29c520d.png)

![trebuchet_field_detachable](https://global.discourse-cdn.com/julialang/original/3X/f/0/f08a7dd2b85b8846fc25b7f95873989b2e32675d.gif)
