Skip to main content

Cable

HELIX Cables are composed primarily of two Unreal Engine components: a Cable and a PhysicsConstraint. The first is used for visual purposes only and the second one gives the effective physical effects that are applied to each end of the Cable.

///info

Cable visuals can be tweaked with :SetForces(), :SetCableSettings() and :SetRenderingSettings() methods. Those methods donโ€™t have effect on the physics being applied and only have effects on the visual representation.

Cable physics can be tweaked with :SetAngularLimits() and :SetLinearLimits().

///

Exampleโ€‹

Example
local CableActor = Cable(Vector(0.0, 0.0, 60.0), true)
local Cube1 = StaticMesh(Vector(52.684121, -37.863267, 92.023095), Quat(180, 0, 0, 1), '/Engine/BasicShapes/Cube.Cube', true)
local Cube2 = StaticMesh(Vector(44.109754, -534.058274, 91.712091), Quat(0, 180, 0, 1), '/Engine/BasicShapes/Cube.Cube', true)
CableActor:AttachStartTo(Cube1, Vector(0, 0, 0), '')
CableActor:AttachEndTo(Cube2, Vector(0, 0, 0), '')

Variablesโ€‹

NameType
CableComponentUCableComponent
PhysicsComponentUPhysicsConstraintComponent

Constructorโ€‹

  • returns: table
local CableActor = Cable(Vector(0.0, 0.0, 60.0), true)
print(CableActor.Object) -- AActor
print(CableActor.CableComponent) -- UCableComponent
print(CableActor.PhysicsComponent) -- UPhysicsConstraintComponent
TypeNameDefaultDescription
VectorStartLocationThe start location of the cable, this gets overridden upon attachment.
boolean?bEnableVisualstrueWhether the cable actor is visible

Functionsโ€‹

AttachStartToโ€‹

Attaches the start of a cable to another actor

  • TargetActor Actor: The actor to attach to.
  • RelativeLocation Vector: Local offset from the attach point.
  • Socket string: Optional socket name.
  • returns: boolean
local success = CableActor:AttachStartTo(TargetActor, RelativeLocation, Socket)

AttachEndToโ€‹

Attaches the end of a cable to another actor

  • TargetActor: Actor โ€” the actor to attach the end to
  • RelativeLocation: Vector โ€” local offset from the attach point
  • Socket: string โ€” optional socket name on the target
CableActor:AttachEndTo(TargetActor, RelativeLocation, Socket)

DetachEndโ€‹

Detaches the end of the cable from the actor

CableActor:DetachEnd()

DetachStartโ€‹

Detaches the start of the cable from the actor

CableActor:DetachStart()

SetCableSettingsโ€‹

Sets the cable settings, like length

  • Length: number โ€” rope length in Unreal units
  • Segments: number โ€” visual segment count (smoothness vs. cost)
  • SolverIterations: number โ€” extra solver passes for stability/quality
CableActor:SetCableSettings(Length, Segments, SolverIterations)

SetForcesโ€‹

Sets the vector of force to be applied to all particles in the cable

  • Force: Vector โ€” constant world-space force per particle
  • GravityScale: number โ€” multiplier for rope gravity (e.g., 0.5 is lighter)
CableActor:SetForces(Force, GravityScale)

SetAngularLimitsโ€‹

Sets the angular limits for the cable

  • Swing1Motion: ConstraintMotion โ€” Free, Limited, or Locked
  • Swing2Motion: ConstraintMotion โ€” Free, Limited, or Locked
  • TwistMotion: ConstraintMotion โ€” Free, Limited, or Locked
  • Swing1LimitAngle: number โ€” degrees, only used when motion is Limited
  • Swing2LimitAngle: number โ€” degrees, only used when motion is Limited
  • TwistLimitAngle: number โ€” degrees, only used when motion is Limited
CableActor:SetAngularLimits(Swing1Motion, Swing2Motion, TwistMotion, Swing1LimitAngle, Swing2LimitAngle, TwistLimitAngle)

SetLinearLimitsโ€‹

Sets the linear limits for the cable

  • XMotion: ConstraintMotion โ€” Free, Limited, or Locked
  • YMotion: ConstraintMotion โ€” Free, Limited, or Locked
  • ZMotion: ConstraintMotion โ€” Free, Limited, or Locked
  • Limit: number โ€” distance limit used when motion is Limited
  • Restitution: number โ€” bounciness when hitting the limit
  • bUseSoftConstraint: boolean โ€” enables spring-like behavior
  • Stiffness: number โ€” spring stiffness when soft constraint is enabled
  • Damping: number โ€” spring damping when soft constraint is enabled
CableActor:SetLinearLimits(XMotion, YMotion, ZMotion, Limit, Restitution, bUseSoftConstraint, Stiffness, Damping)

SetRenderingSettingsโ€‹

Sets the rendering settings for the cable

  • Width: number โ€” rope thickness in Unreal units
  • NumberOfSides: number โ€” cylinder sides (visual smoothness)
  • TileMaterial: number โ€” material tiling along the rope
CableActor:SetRenderingSettings(Width, NumberOfSides, TileMaterial)

GetAttachedStartToโ€‹

Gets the actor that the start of the cable is attached to

CableActor:GetAttachedStartTo()

GetAttachedEndToโ€‹

Gets the component referenced that the end of the cable is attached to

CableActor:GetAttachedEndTo()
โœจ