Skip to content

[Feature] 2D joints and constraints #123

Open

Description

@vmarcella

Overview

Add joints that connect rigid bodies together with various constraint types
for doors, chains, vehicles, and character rigs.

Current State

No response

Scope

Goals:

  • Revolute joint (hinge, rotation only)
  • Prismatic joint (slider, translation only)
  • Distance joint (fixed distance between points)
  • Spring joint (soft distance constraint)
  • Motor support on applicable joints

Non-Goals:

  • Rope/chain simulation
  • Breakable joints
  • Gear joints

Proposed API

pub struct Joint2D {
  // handle
}

pub struct RevoluteJointBuilder {
  body_a: RigidBodyHandle,
  body_b: RigidBodyHandle,
  anchor_a: [f32; 2],
  anchor_b: [f32; 2],
  motor_speed: Option<f32>,
  motor_torque: Option<f32>,
}

pub struct DistanceJointBuilder {
  body_a: RigidBodyHandle,
  body_b: RigidBodyHandle,
  anchor_a: [f32; 2],
  anchor_b: [f32; 2],
  rest_length: f32,
  stiffness: f32,
  damping: f32,
}

impl RevoluteJointBuilder {
  pub fn new(body_a: RigidBodyHandle, body_b: RigidBodyHandle) -> Self;
  pub fn with_anchors(self, a: [f32; 2], b: [f32; 2]) -> Self;
  pub fn with_motor(self, speed: f32, max_torque: f32) -> Self;
  pub fn build(self, world: &mut PhysicsWorld2D) -> Joint2D;
}

Acceptance Criteria

  • Revolute joint constrains rotation around anchor
  • Prismatic joint constrains to linear motion
  • Distance joint maintains fixed distance
  • Spring joint provides soft constraint with oscillation
  • Motors can drive joint motion
  • Example demonstrating a swinging door or pendulum

Affected Crates

lambda-rs, lambda-rs-platform

Notes

  • Anchors in local body coordinates
  • Stiffness/damping for spring behavior

Activity

  1. added
    enhancementNew feature or request
    lambda-rsIssues pertaining to the core framework
    lambda-rs-platformIssues pertaining to the dependency & platform wrappers
    physicsAll things related to physics
    on Jan 27, 2026
  2. added a commit that references this issue on Mar 14, 2026
    b134676
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlambda-rsIssues pertaining to the core frameworklambda-rs-platformIssues pertaining to the dependency & platform wrappersphysicsAll things related to physics

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions