# A template for the piston and rod for a hydraulic cylinder
trait CylinderPart:
    bottom_height is Real: length * 0.5
    bearing_separation is Real: 0.15
    length is Real: 1.0

    # Connector to the other CylinderBody
    cylinder_connector is Interfaces.RedirectedCylinderConnector:
        position: length * Definitions.AlongBodyNormal

    # A central connector for connecting the cylinder to bearings
    snap_connector is Interfaces.RedirectedCraneAxleConnector:
        position.x: 0
    # The left and right bearings
    bearing_left is Interfaces.RedirectedCraneAxleConnector:
        position: snap_connector.position - bearing_separation * 0.5 * Definitions.ModelPlaneNormal
    bearing_right is Interfaces.RedirectedCraneAxleConnector:
        position: snap_connector.position + bearing_separation * 0.5 * Definitions.ModelPlaneNormal

    # Group the connectors
    axle_bearing_interface is Interfaces.AxleBearingInterface:
        left_bearing: bearing_left
        snap_center: snap_connector
        right_bearing: bearing_right
