DiscoverLearnDocumentationGet OpenPLXSearch Contact

Concepts Create RigidBodies

This concepts page walks through building rigid bodies:

  • declaring rigid body models
  • assigning properties relevant to body behavior
  • composing bodies into larger systems
  • preparing bodies for interaction with mates and geometry

From geometry to rigid body

In the previous concepts page, geometry and visuals were placed directly in a Physics3D.System. Now we attach them to a Physics3D.Bodies.RigidBody, which makes the model part of the physics body simulation.

SimpleWheelBody is Physics3D.Bodies.RigidBody:
    geometry is Physics3D.Geometries.Cylinder:
        radius: 0.25
        height: 0.15
    visual is Visuals.Geometries.Cylinder:
        radius: geometry.radius
        height: geometry.height

geometry defines the physical shape and visual defines the rendered shape. Keeping visual linked to geometry avoids duplicated dimensions.

Dynamic and static rigid bodies

Rigid bodies are dynamic by default. Use is_dynamic: false when a body should remain fixed.

GroundBody is Physics3D.Bodies.RigidBody:
    is_dynamic: false
    geometry is Physics3D.Geometries.Box:
        size: Math.Vec3.from_xyz(20.0, 20.0, 0.5)
    visual is Visuals.Geometries.Box:
        size: geometry.size

Use this pattern for floors, fixed mounts, and static environment parts.

Set inertia explicitly

You can set mass and inertia explicitly on a rigid body.

ToolBody is Physics3D.Bodies.RigidBody:
    geometry is Physics3D.Geometries.Box:
        size: Math.Vec3.from_xyz(0.4, 0.2, 0.1)
    visual is Visuals.Geometries.Box:
        size: geometry.size
    inertia:
        mass: 5.0
        tensor: Physics3D.Bodies.Inertia.symmetric_tensor(
            Math.Vec3.from_xyz(0.08, 0.06, 0.04),
            0.0,
            0.0,
            0.0
        )

This is useful when you already know the physical properties you want.

Compose rigid bodies in a system

A Physics3D.System can contain many rigid bodies:

WheelBody is Physics3D.Bodies.RigidBody:
    geometry is Physics3D.Geometries.Cylinder:
        radius: 0.25
        height: 0.15
    visual is Visuals.Geometries.Cylinder:
        radius: geometry.radius
        height: geometry.height

AxleBody is Physics3D.Bodies.RigidBody:
    geometry is Physics3D.Geometries.Cylinder:
        radius: 0.05
        height: 1.2
    visual is Visuals.Geometries.Cylinder:
        radius: geometry.radius
        height: geometry.height

WheelAssembly is Physics3D.System:
    axle is AxleBody
    left_wheel is WheelBody:
        kinematics.local_transform.position.y: -0.6
    right_wheel is WheelBody:
        kinematics.local_transform.position.y: 0.6

This gives a clean structure where each body has its own geometry and visual. Note that the local_transform of the rigid body is located in the kinematics attribute.

Final example: Motorcycle systems with rigid bodies

Below is an updated version of the motorcycle structure from the system concepts, now with rigid bodies in each subsystem. The Frame subsystem has more than one rigid body.

CylindricalBody is Physics3D.Bodies.RigidBody:
    geometry is Physics3D.Geometries.Cylinder:
        radius: 0.2
        height: 0.12
    visual is Visuals.Geometries.Cylinder:
        radius: geometry.radius
        height: geometry.height

WheelBody is CylindricalBody:
    geometry.radius: 0.33

FrontAxleBody is CylindricalBody:
    geometry.radius: 0.05
    geometry.height: 0.2

Frame is Physics3D.System:
    main_beam is Physics3D.Bodies.RigidBody:
        geometry is Physics3D.Geometries.Box:
            size: Math.Vec3.from_xyz(1.4, 0.15, 0.12)
        visual is Visuals.Geometries.Box:
            size: main_beam.geometry.size
    steering_head is CylindricalBody:
        geometry.radius: 0.06
        geometry.height: 0.5
        kinematics.local_transform.position: Math.Vec3.from_xyz(0.6, 0.0, 0.1)

MotorCycle is Physics3D.System:
    front_wheel is WheelBody:
        kinematics.local_transform.position: Math.Vec3.from_xyz(1.1, 0.0, 0.33)
    rear_wheel is WheelBody:
        geometry.height: 0.14
        kinematics.local_transform.position: Math.Vec3.from_xyz(-1.1, 0.0, 0.33)
    front_axle is FrontAxleBody:
        kinematics.local_transform:
            position: front_wheel.kinematics.local_transform.position
            rotation: Math.Quat.from_euler_angles(0.0, Math.Functions.deg_to_rad(90.0), 0.0)
    frame is Frame:
        local_transform.position: Math.Vec3.from_xyz(0.0, 0.0, 0.8)

This structure keeps the model readable:

  • it uses the same model names and hierarchy as the mates concepts
  • wheel and axle bodies share one reusable CylindricalBody template
  • positions are set explicitly here, before introducing connectors and mates

Prepare for mates

In the next concepts, these bodies will be connected with mates. A good preparation step is to keep stable body names (axle, left_wheel, right_wheel) and clear local transforms, since mates and mate connectors will reference those parts directly.

OpenPLX is a work in progress. This draft version will evolve with user feedback and experience. We welcome your input and collaboration.
X