codeAPI Reference

s&box HydraulicEntity: Hydraulic piston

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

HydraulicEntity Component API Reference

HydraulicEntity is a Component that implements IPlayerControllable for hydraulic pistons. It controls a SliderJoint to extend/retract between min and max lengths. Supports manual control and animated modes with easing.

Type Signature

CSHARP
public class HydraulicEntity : Component, IPlayerControllable
{
    [Property, Range(0, 100), ClientEditable] public float MinLength { get; set; } = 10f;
    [Property, Range(0, 100), ClientEditable] public float MaxLength { get; set; } = 100f;
    [Property, Range(0, 1), ClientEditable] public float Length { get; set; } = 0.5f;
    [Property, Range(0, 1), ClientEditable] public float Speed { get; set; } = 0.25f;
    [Property, Sync, ClientEditable] public ClientInput Push { get; set; }
    [Property, Range(0, 1), ClientEditable] public float PushSpeed { get; set; } = 0.25f;
    [Property, Sync, ClientEditable] public ClientInput Pull { get; set; }
    [Property, Range(0, 1), ClientEditable] public float PullSpeed { get; set; } = 0.25f;
    [Property, Sync, ClientEditable] public ClientInput Toggle { get; set; }
    [Property, Sync, ClientEditable] public ClientInput Activate { get; set; }
    [Property] public SliderJoint Joint { get; set; }

    public enum EaseType { Linear, EaseIn, EaseOut, EaseInOut, Bounce }

    public void SetActiveState(bool state);
}

Properties

Animated Mode Properties

Methods

SetActiveState(bool state)

Sets the active state and toggles the OnEffect GameObject. Used for visual feedback.

IPlayerControllable Implementation

Usage

CSHARP
// Create a hydraulic entity
var hydraulic = GameObject.Components.Create<HydraulicEntity>();
hydraulic.Joint = sliderJoint;
hydraulic.MinLength = 20f;
hydraulic.MaxLength = 80f;
hydraulic.Push = Input.Button("attack1");
hydraulic.Pull = Input.Button("attack2");

Notes

  • Length is clamped between 0 and 1
  • Joint MinLength and MaxLength are updated based on Length
  • Updates CapsuleCollider for trigger collision
  • Updates SkinnedModelRenderer bones for procedural animation
  • Animated mode uses Easing functions for smooth animation
  • OnEffect GameObject is enabled when active
Was this helpful?