menu_bookDocumentation

Sandbox: Hydraulic tool — motorized SliderJoint with LineRenderer shaft

calendar_today May 4, 2026 schedule ~2 min read person patrickjr verified 50

Sandbox Hydraulic Tool — Motorized SliderJoint Constraints

The Hydraulic tool creates a SliderJoint between two objects with a HydraulicEntity component that can extend and retract the joint at runtime.

Two modes

Standard hydraulic (default): Creates two child GameObjects aligned along the axis between the two selection points, connected by a SliderJoint. A LineRenderer renders the shaft as a cylinder. Ball joint hydraulic (BallJoints = true): Uses BallSocketJoint at both ends with a SliderJoint in the middle, allowing the hydraulic to pivot freely at both attachment points.

GameObject hierarchy (standard)

CODE
point1.GameObject
  └── "hydraulic_a" (go1) — WorldRotation = LookAt(-line), tag: "constraint"
        ├── ConstraintCleanup (attachment = go2)
        ├── "hydraulic_cap_a" — ModelRenderer (tool_hydraulic.vmdl)
        ├── LineRenderer (points: [go1, go2], FaceMode.Cylinder)
        └── "hydraulic" (jointGo)
              ├── SliderJoint (body = go2, MinLength = MaxLength = distance)
              ├── HydraulicEntity (Length=0.5, MinLength=5, MaxLength=dist*2)
              └── CapsuleCollider

point2.GameObject
  └── "hydraulic_b" (go2) — WorldRotation = LookAt(-line), tag: "constraint"
        └── "hydraulic_cap_b" — ModelRenderer (tool_hydraulic.vmdl)

HydraulicEntity

HydraulicEntity holds a reference to the SliderJoint and exposes Length, MinLength, MaxLength. At runtime, players can extend/retract the hydraulic by changing Length, which updates Joint.MinLength and Joint.MaxLength.

Key properties

PropertyDefaultDescription
BallJointsfalseUse ball socket joints at both ends
Initial MinLength / MaxLengthdistance between pointsLocked at creation distance
HydraulicEntity.MinLength5.0Minimum extension
HydraulicEntity.MaxLengthdist * 2Maximum extension

Removal

Reload (R) removes all hydraulics between the aimed object and any connected object, found via HydraulicEntity components in ConstraintCleanup children.

Visual

The shaft uses a LineRenderer with FaceMode.Cylinder, the metaltileline.vmat material, WorldSpace = true, and UnitsPerTexture = 32 for a tiling metal texture that scales with length.

Was this helpful?