---
url: /dyad/stable/stdlib/MultibodyComponents/components/World.md
description: Dyad World docs.  The root component for all 3D multibody models.
---

# `World` {#World}

The root component for all 3D multibody models.

Every model must include exactly one World component at the top level. The `frame_b` is fixed at the origin with identity orientation.

Global gravity parameters (`n`, `g`, `mu`, `point_gravity`) are set here and referenced by other components via `gravity_acceleration`.

## Usage {#Usage}

`MultibodyComponents.World(render=true, n=[0, -1, 0], g=9.80665, mu=3.986004418e14, nominal_length=1, axis_length=nominal_length, axis_radius=nominal_length / 20, default_joint_length=nominal_length / 10, default_joint_width=nominal_length / 20, default_body_diameter=nominal_length / 9, default_width_fraction=20, default_arrow_diameter=nominal_length / 40, default_force_length=nominal_length / 10, default_force_width=nominal_length / 20, default_N_to_m=1000, default_Nm_to_m=1000, default_body_color=[0.60, 0.0, 0.5019608, 1.0], default_rod_color=[0.5019608, 0.0, 0.5019608, 1.0], default_joint_color=[1, 0, 0, 1], default_prismatic_color=[0, 0.8, 1, 1], default_spring_color=[0, 0, 1, 1], default_force_color=[0, 1, 0, 0.5], default_sensor_color=[0, 1, 0, 0.5], render_ground=false, ground_axis_u=[1, 0, 0], ground_length_u=2, ground_length_v=2, ground_color=[0.784, 0.784, 0.784, 1.0])`

## Parameters: {#Parameters:}

|                      Name |                                                                                                                                         Description | Units |             Default value |
| -------------------------:| ---------------------------------------------------------------------------------------------------------------------------------------------------:| -----:| -------------------------:|
|           `point_gravity` | Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of `n`. |     – |                     false |
|                  `render` |                                                                                                                                                     |     – |                      true |
|                       `n` |                                                                                                                                   gravity direction |     – |                \[0, -1, 0] |
|                       `g` |                                                                                                                 gravitational acceleration of world |  m/s2 |                   9.80665 |
|                      `mu` |                                                                                  Gravity field constant \[m³/s²] (default = field constant of earth) |     – |            3.986004418e14 |
|          `nominal_length` |                                                                                                   Nominal length for scaling visualization defaults |     – |                         1 |
|             `axis_length` |                                                                                                    Length of the world coordinate axes in rendering |     – |            nominal_length |
|             `axis_radius` |                                                                                  Radius (shaft thickness) of the world coordinate axes in rendering |     – |       nominal_length / 20 |
|    `default_joint_length` |                                                                                                                      Default length of joint shapes |     – |       nominal_length / 10 |
|     `default_joint_width` |                                                                                                                       Default width of joint shapes |     – |       nominal_length / 20 |
|   `default_body_diameter` |                                                                                                                    Default diameter of body spheres |     – |        nominal_length / 9 |
|  `default_width_fraction` |                                                                                                    Default width fraction (width = length/fraction) |     – |                        20 |
|  `default_arrow_diameter` |                                                                                                                        Default arrow shaft diameter |     – |       nominal_length / 40 |
|    `default_force_length` |                                                                                                                  Default force visualization length |     – |       nominal_length / 10 |
|     `default_force_width` |                                                                                                                   Default force visualization width |     – |       nominal_length / 20 |
|          `default_N_to_m` |                                                                                                                   Default force arrow scaling (N/m) |     – |                      1000 |
|         `default_Nm_to_m` |                                                                                                                 Default torque arrow scaling (Nm/m) |     – |                      1000 |
|      `default_body_color` |                                                                                                                           Default body color (RGBA) |     – | \[0.60, 0.0,...19608, 1.0] |
|       `default_rod_color` |                                                                                                                Default rod/translation color (RGBA) |     – | \[0.5019608,...19608, 1.0] |
|     `default_joint_color` |                                                                                                                          Default joint color (RGBA) |     – |              \[1, 0, 0, 1] |
| `default_prismatic_color` |                                                                                                                Default prismatic joint color (RGBA) |     – |            \[0, 0.8, 1, 1] |
|    `default_spring_color` |                                                                                                                         Default spring color (RGBA) |     – |              \[0, 0, 1, 1] |
|     `default_force_color` |                                                                                                                   Default force/torque color (RGBA) |     – |            \[0, 1, 0, 0.5] |
|    `default_sensor_color` |                                                                                                                         Default sensor color (RGBA) |     – |            \[0, 1, 0, 0.5] |
|           `render_ground` |                                                                                                            Whether to render the world ground plane |     – |                     false |
|           `ground_axis_u` |                                                                             Unit vector along 1st axis (u) of ground plane, resolved in world frame |     – |                 \[1, 0, 0] |
|         `ground_length_u` |                                                                                                          Length of ground plane along ground_axis_u |     – |                         2 |
|         `ground_length_v` |                                                                                               Length of ground plane perpendicular to ground_axis_u |     – |                         2 |
|            `ground_color` |                                                                                                                      RGBA color of the ground plane |     – | \[0.784, 0.7...0.784, 1.0] |

## Connectors {#Connectors}

* `frame_b` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
The root component for all 3D multibody models.

Every model must include exactly one World component at the top level.
The `frame_b` is fixed at the origin with identity orientation.

Global gravity parameters (`n`, `g`, `mu`, `point_gravity`) are set here
and referenced by other components via `gravity_acceleration`.
"""
external component World
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter render::Boolean = true
  "gravity direction"
  parameter n::Real[3] = [0, -1, 0]
  "gravitational acceleration of world"
  parameter g::Acceleration = 9.80665
  "Gravity field constant [m³/s²] (default = field constant of earth)"
  parameter mu::Real = 3.986004418e14
  "Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of `n`."
  structural parameter point_gravity::Boolean = false
  "Nominal length for scaling visualization defaults"
  parameter nominal_length::Real = 1
  "Length of the world coordinate axes in rendering"
  parameter axis_length::Real = nominal_length
  "Radius (shaft thickness) of the world coordinate axes in rendering"
  parameter axis_radius::Real = nominal_length / 20
  "Default length of joint shapes"
  parameter default_joint_length::Real = nominal_length / 10
  "Default width of joint shapes"
  parameter default_joint_width::Real = nominal_length / 20
  "Default diameter of body spheres"
  parameter default_body_diameter::Real = nominal_length / 9
  "Default width fraction (width = length/fraction)"
  parameter default_width_fraction::Real = 20
  "Default arrow shaft diameter"
  parameter default_arrow_diameter::Real = nominal_length / 40
  "Default force visualization length"
  parameter default_force_length::Real = nominal_length / 10
  "Default force visualization width"
  parameter default_force_width::Real = nominal_length / 20
  "Default force arrow scaling (N/m)"
  parameter default_N_to_m::Real = 1000
  "Default torque arrow scaling (Nm/m)"
  parameter default_Nm_to_m::Real = 1000
  "Default body color (RGBA)"
  parameter default_body_color::Real[4] = [0.60, 0.0, 0.5019608, 1.0]
  "Default rod/translation color (RGBA)"
  parameter default_rod_color::Real[4] = [0.5019608, 0.0, 0.5019608, 1.0]
  "Default joint color (RGBA)"
  parameter default_joint_color::Real[4] = [1, 0, 0, 1]
  "Default prismatic joint color (RGBA)"
  parameter default_prismatic_color::Real[4] = [0, 0.8, 1, 1]
  "Default spring color (RGBA)"
  parameter default_spring_color::Real[4] = [0, 0, 1, 1]
  "Default force/torque color (RGBA)"
  parameter default_force_color::Real[4] = [0, 1, 0, 0.5]
  "Default sensor color (RGBA)"
  parameter default_sensor_color::Real[4] = [0, 1, 0, 0.5]
  "Whether to render the world ground plane"
  parameter render_ground::Boolean = false
  "Unit vector along 1st axis (u) of ground plane, resolved in world frame"
  parameter ground_axis_u::Real[3] = [1, 0, 0]
  "Length of ground plane along ground_axis_u"
  parameter ground_length_u::Real = 2
  "Length of ground plane perpendicular to ground_axis_u"
  parameter ground_length_v::Real = 2
  "RGBA color of the ground plane"
  parameter ground_color::Real[4] = [0.784, 0.784, 0.784, 1.0]
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/World3D.svg"},
    "labels": [
      {
        "label": "g = $(g)",
        "x": 70,
        "y": 970,
        "rot": 0,
        "layer": "all",
        "attrs": {
          "fill": "black",
          "font-size": "12",
          "dominant-baseline": "central",
          "text-anchor": "left"
        }
      },
      {
        "label": "n = $(n)",
        "x": 930,
        "y": 970,
        "rot": 0,
        "layer": "all",
        "attrs": {
          "fill": "black",
          "font-size": "12",
          "dominant-baseline": "central",
          "text-anchor": "left"
        }
      }
    ]
  }
}
end
```

```dyad
"""
The root component for all 3D multibody models.

Every model must include exactly one World component at the top level.
The `frame_b` is fixed at the origin with identity orientation.

Global gravity parameters (`n`, `g`, `mu`, `point_gravity`) are set here
and referenced by other components via `gravity_acceleration`.
"""
external component World
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter render::Boolean = true
  "gravity direction"
  parameter n::Real[3] = [0, -1, 0]
  "gravitational acceleration of world"
  parameter g::Acceleration = 9.80665
  "Gravity field constant [m³/s²] (default = field constant of earth)"
  parameter mu::Real = 3.986004418e14
  "Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of `n`."
  structural parameter point_gravity::Boolean = false
  "Nominal length for scaling visualization defaults"
  parameter nominal_length::Real = 1
  "Length of the world coordinate axes in rendering"
  parameter axis_length::Real = nominal_length
  "Radius (shaft thickness) of the world coordinate axes in rendering"
  parameter axis_radius::Real = nominal_length / 20
  "Default length of joint shapes"
  parameter default_joint_length::Real = nominal_length / 10
  "Default width of joint shapes"
  parameter default_joint_width::Real = nominal_length / 20
  "Default diameter of body spheres"
  parameter default_body_diameter::Real = nominal_length / 9
  "Default width fraction (width = length/fraction)"
  parameter default_width_fraction::Real = 20
  "Default arrow shaft diameter"
  parameter default_arrow_diameter::Real = nominal_length / 40
  "Default force visualization length"
  parameter default_force_length::Real = nominal_length / 10
  "Default force visualization width"
  parameter default_force_width::Real = nominal_length / 20
  "Default force arrow scaling (N/m)"
  parameter default_N_to_m::Real = 1000
  "Default torque arrow scaling (Nm/m)"
  parameter default_Nm_to_m::Real = 1000
  "Default body color (RGBA)"
  parameter default_body_color::Real[4] = [0.60, 0.0, 0.5019608, 1.0]
  "Default rod/translation color (RGBA)"
  parameter default_rod_color::Real[4] = [0.5019608, 0.0, 0.5019608, 1.0]
  "Default joint color (RGBA)"
  parameter default_joint_color::Real[4] = [1, 0, 0, 1]
  "Default prismatic joint color (RGBA)"
  parameter default_prismatic_color::Real[4] = [0, 0.8, 1, 1]
  "Default spring color (RGBA)"
  parameter default_spring_color::Real[4] = [0, 0, 1, 1]
  "Default force/torque color (RGBA)"
  parameter default_force_color::Real[4] = [0, 1, 0, 0.5]
  "Default sensor color (RGBA)"
  parameter default_sensor_color::Real[4] = [0, 1, 0, 0.5]
  "Whether to render the world ground plane"
  parameter render_ground::Boolean = false
  "Unit vector along 1st axis (u) of ground plane, resolved in world frame"
  parameter ground_axis_u::Real[3] = [1, 0, 0]
  "Length of ground plane along ground_axis_u"
  parameter ground_length_u::Real = 2
  "Length of ground plane perpendicular to ground_axis_u"
  parameter ground_length_v::Real = 2
  "RGBA color of the ground plane"
  parameter ground_color::Real[4] = [0.784, 0.784, 0.784, 1.0]
relations
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/World3D.svg"},
    "labels": [
      {
        "label": "g = $(g)",
        "x": 70,
        "y": 970,
        "rot": 0,
        "layer": "all",
        "attrs": {
          "fill": "black",
          "font-size": "12",
          "dominant-baseline": "central",
          "text-anchor": "left"
        }
      },
      {
        "label": "n = $(n)",
        "x": 930,
        "y": 970,
        "rot": 0,
        "layer": "all",
        "attrs": {
          "fill": "black",
          "font-size": "12",
          "dominant-baseline": "central",
          "text-anchor": "left"
        }
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`ActuatedPrismaticTest`](World.md)

  * [`BodyShapePendulumTest`](World.md)

  * [`CentrifugalTest`](World.md)

  * [`CutForceTest`](World.md)

  * [`CutTorqueTest`](World.md)

  * [`OneDOFRollingWheelJointTest`](World.md)

  * [`OneDOFSlippingWheelSegwayTest`](World.md)

  * [`OneDOFSlippingWheelSpinningTest`](World.md)

  * [`PlanarToMultiBodyEmbeddedTest`](World.md)

  * [`PlanarToMultiBodyKinematicTest`](World.md)

  * [`PlanarToMultiBodyPendulumTest`](World.md)

  * [`PrescribedAccelerationTest`](World.md)

  * [`PrescribedPoseTest`](World.md)

  * [`PrescribedPositionTest`](World.md)

  * [`PrescribedVelocityTest`](World.md)

  * [`RelativeForceTest`](World.md)

  * [`SensorsTest`](World.md)

  * [`TestCableCut`](World.md)

  * [`TestCableEndJoints`](World.md)

  * [`TestCableNoEndJoints`](World.md)

  * [`TestPlanarCableEndJoints`](World.md)

  * [`TestPlanarCableNoEndJoints`](World.md)

  * [`WorldForceTest`](World.md)
