Currently I am trying to simulate a double pendulum in Unity. The pendulum consists of two cuboid rigid body links. Both links have a mass of 1 kg and are of the same size: a length of 1m, width of 0.1 m and depth of 0.05 m. Each link’s rigid body settings are: .useGravity = true, .drag = 0, .angularDrag = 0. Both links contain a hinge joint that is able to rotate around the z-axis and I’ve set .autoConfigureConnectedAnchor = true. The second link is connected to the first link’s rigid body.
The simulation works and the pendulum swings, but not as expected. I simulated the pendulum I described above in Matlab and this simulation behaves as I’d expect - more “chaotic” than the Unity simulation.
I’ve created animations in Matlab that plot the pendulum’s trajectory in the x-y-plane. I’ll attach both trajectories here.
Can anyone explain to me why the unity simulation does not behave as a real double pendulum would (or in that case, the Matlab simulation)? Any hints?
This is the Matlab trajectory:
This is the Unity trajectory:
Any questions?