codeAPI Reference

s&box BallSocketPair: Hydraulic ball socket visual

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

BallSocketPair Component API Reference

BallSocketPair is a Component that aligns two ball socket models towards each other and updates a line renderer between them. Used for visual representation of hydraulic ball socket joints.

Type Signature

CSHARP
public class BallSocketPair : Component
{
    [Property] public SkinnedModelRenderer BallModelA { get; set; }
    [Property] public SkinnedModelRenderer BallModelB { get; set; }
    [Property] public LineRenderer ShaftRenderer { get; set; }
}

Properties

Behavior

In OnUpdate:

  • Calculates direction vector between BallModelA and BallModelB

  • Aligns both ball models to face each other (pitch -90 degrees)

  • Handles vertical alignment (uses Forward instead of Up when nearly vertical)

  • Updates LineRenderer points between bone "end" objects on both models

Usage

CSHARP
// Attach to a hydraulic GameObject with ball socket models
var ballPair = GameObject.Components.Create<BallSocketPair>();
ballPair.BallModelA = modelA;
ballPair.BallModelB = modelB;
ballPair.ShaftRenderer = shaftLine;

Notes

  • Models must have a bone named "end" for line renderer attachment
  • Ball models are rotated to face each other with -90 degree pitch
  • Shaft renderer connects the "end" bones of both models
  • Used by Hydraulic tool for visual feedback
  • Updates every frame in OnUpdate
Was this helpful?