Simulating articulated rigid body dynamics