<?xml version="1.0" ?>
<sdf version="1.6">
  <world name="detachable_joint">
    <physics name="fast" type="ignored">
      <real_time_factor>0</real_time_factor>
    </physics>

    <plugin filename="ignition-gazebo-physics-system"
      name="ignition::gazebo::systems::Physics"/>

    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
        </collision>
      </link>
    </model>

    <model name="M1">
      <pose>0 0 1 0 0 0</pose>
      <link name="body">
        <inertial>
          <mass>1</mass>
          <inertia>
            <ixx>0.667</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.667</iyy>
            <iyz>0</iyz>
            <izz>0.667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>2.0 2.0 2.0</size>
            </box>
          </geometry>
        </collision>
      </link>

      <plugin filename="ignition-gazebo-detachable-joint-system" name="ignition::gazebo::systems::DetachableJoint">
        <parent_link>body</parent_link>
        <child_model>M2</child_model>
        <child_link>body</child_link>
      </plugin>
    </model>

    <model name="M2">
      <pose>0 0 5 0 0 0</pose>
      <link name="body">
        <inertial>
          <mass>1</mass>
          <inertia>
            <ixx>0.667</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.667</iyy>
            <iyz>0</iyz>
            <izz>0.667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>2.0 2.0 2.0</size>
            </box>
          </geometry>
        </collision>
      </link>
    </model>


    <model name="M3">
      <pose>10 0 1 0 0 0</pose>
      <link name="body1">
        <inertial>
          <mass>1</mass>
          <inertia>
            <ixx>0.667</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.667</iyy>
            <iyz>0</iyz>
            <izz>0.667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>2.0 2.0 2.0</size>
            </box>
          </geometry>
        </collision>
      </link>
      <link name="body2">
        <pose>0 0 5 0 0 0</pose>
        <inertial>
          <mass>1</mass>
          <inertia>
            <ixx>0.667</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.667</iyy>
            <iyz>0</iyz>
            <izz>0.667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>2.0 2.0 2.0</size>
            </box>
          </geometry>
        </collision>
      </link>
      <plugin filename="ignition-gazebo-detachable-joint-system" name="ignition::gazebo::systems::DetachableJoint">
        <parent_link>body1</parent_link>
        <child_model>__model__</child_model>
        <child_link>body2</child_link>
      </plugin>
    </model>
  </world>
</sdf>
