Cable
A Cable represents a Physics Constraint which joins two Actors with a rope-like visual representation between them.
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.
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()
.
After attaching the two sides of your cable, the physics can be tweaked to affect how the constraint will affect the objects.
Cables are automatically destroyed when one of the sides are detached
Examplesβ
local my_cable = Cable(Vector())
local cube_01 = Prop(Vector(100, 100, 100), Rotator(), "helix::SM_Cube")
local cube_02 = Prop(Vector(200, 0, 100), Rotator(), "helix::SM_Cube")
my_cable:AttachStartTo(cube_01)
my_cable:AttachEndTo(cube_02)
Constructorsβ
Default Constructorβ
local my_cable = Cable(location, enable_visuals?)
Static Functionsβ
Inherited Entity Static Functions
Returns | Name | Description | |
---|---|---|---|
table of Base Entity | GetAll | Returns a table containing all Entities of the class this is called on | |
Base Entity | GetByIndex | Returns a specific Entity of this class at an index | |
integer | GetCount | Returns how many Entities of this class exist | |
iterator | GetPairs | Returns an iterator with all Entities of this class to be used with pairs() | |
table | Inherit | Inherits this class with the Inheriting System | |
table of table | GetInheritedClasses | Gets a list of all directly inherited classes from this Class created with the Inheriting System | |
table or nil | GetParentClass | Gets the parent class if this Class was created with the Inheriting System | |
boolean | IsChildOf | Gets if this Class is child of another class if this Class was created with the Inheriting System | |
function | Subscribe | Subscribes to an Event for all entities of this Class | |
function | SubscribeRemote | Subscribes to a custom event called from server | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed |
Functionsβ
Inherited Entity Functions
Returns | Name | Description | |
---|---|---|---|
integer | GetID | Gets the universal network ID of this Entity (same on both client and server) | |
table | GetClass | Gets the class of this entity | |
boolean | IsA | Recursively checks if this entity is inherited from a Class | |
function | Subscribe | Subscribes to an Event on this specific entity | |
function | SubscribeRemote | Subscribes to a custom event called from server on this specific entity | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed | ||
SetValue | Sets a Value in this Entity | ||
any | GetValue | Gets a Value stored on this Entity at the given key | |
Destroy | Destroys this Entity | ||
boolean | IsValid | Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity) | |
CallRemoteEvent | Calls a custom remote event directly on this entity to a specific Player | ||
CallRemoteEvent | Calls a custom remote event directly on this entity | ||
BroadcastRemoteEvent | Calls a custom remote event directly on this entity to all Players |
Inherited Actor Functions
Returns | Name | Description | |
---|---|---|---|
AddImpulse | Applies a force in world world to this Actor | ||
AttachTo | Attaches this Actor to any other Actor, optionally at a specific bone | ||
Detach | Detaches this Actor from AttachedTo Actor | ||
SetCollision | Sets this Actor's collision type | ||
SetDimension | Sets this Actor's Dimension | ||
SetForce | Adds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel | ||
SetGravityEnabled | Sets whether gravity is enabled on this Actor | ||
SetVisibility | Sets whether the actor is visible or not | ||
SetHighlightEnabled | Sets whether the highlight is enabled on this Actor, and which highlight index to use | ||
SetOutlineEnabled | Sets whether the outline is enabled on this Actor, and which outline index to use | ||
SetLifeSpan | Sets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed. | ||
SetLocation | Sets this Actor's location in the game world | ||
SetRotation | Sets this Actor's rotation in the game world | ||
SetRelativeLocation | Sets this Actor's relative location in local space (only if this actor is attached) | ||
SetRelativeRotation | Sets this Actor's relative rotation in local space (only if this actor is attached) | ||
SetScale | Sets this Actor's scale | ||
SetNetworkAuthority | Sets the Player to have network authority over this Actor | ||
SetNetworkAuthorityAutoDistributed | Sets if this Actor will auto distribute the network authority between players | ||
TranslateTo | Smoothly moves this actor to a location over a certain time | ||
RotateTo | Smoothly rotates this actor to an angle over a certain time | ||
boolean | IsBeingDestroyed | Returns true if this Actor is being destroyed | |
boolean | IsVisible | Returns true if this Actor is visible | |
boolean | IsGravityEnabled | Returns true if gravity is enabled on this Actor | |
boolean | IsInWater | Returns true if this Actor is in water | |
boolean | IsNetworkDistributed | Returns true if this Actor is currently network distributed | |
table of Base Actor | GetAttachedEntities | Gets all Actors attached to this Actor | |
Base Actor or nil | GetAttachedTo | Gets the Actor this Actor is attached to | |
table | GetBounds | Gets this Actor's bounds | |
CollisionType | GetCollision | Gets this Actor's collision type | |
Vector | GetLocation | Gets this Actor's location in the game world | |
Vector | GetRelativeLocation | Gets this Actor's Relative Location if it's attached | |
Player or nil | GetNetworkAuthority | Gets this Actor's Network Authority Player | |
Rotator | GetRotation | Gets this Actor's angle in the game world | |
Rotator | GetRelativeRotation | Gets this Actor's Relative Rotation if it's attached | |
Vector | GetForce | Gets this Actor's force (set by SetForce() ) | |
integer | GetDimension | Gets this Actor's dimension | |
boolean | HasNetworkAuthority | Returns true if the local Player is currently the Network Authority of this Actor | |
boolean | HasAuthority | Gets if this Actor was spawned by the client side | |
Vector | GetScale | Gets this Actor's scale | |
Vector | GetVelocity | Gets this Actor's current velocity | |
AddActorTag | Adds an Unreal Actor Tag to this Actor | ||
RemoveActorTag | Removes an Unreal Actor Tag from this Actor | ||
table of string | GetActorTags | Gets all Unreal Actor Tags on this Actor | |
boolean | WasRecentlyRendered | Gets if this Actor was recently rendered on screen | |
float | GetDistanceFromCamera | Gets the distance of this Actor from the Camera | |
float | GetScreenPercentage | Gets the percentage of this Actor size in the screen |
Inherited Paintable Functions
Returns | Name | Description | |
---|---|---|---|
SetMaterial | Sets the material at the specified index of this Actor | ||
SetMaterialFromCanvas | Sets the material at the specified index of this Actor to a Canvas object | ||
SetMaterialFromSceneCapture | Sets the material at the specified index of this Actor to a SceneCapture object | ||
SetMaterialFromWebUI | Sets the material at the specified index of this Actor to a WebUI object | ||
ResetMaterial | Resets the material from the specified index to the original one | ||
SetMaterialColorParameter | Sets a Color parameter in this Actor's material | ||
SetMaterialScalarParameter | Sets a Scalar parameter in this Actor's material | ||
SetMaterialTextureParameter | Sets a texture parameter in this Actor's material to an image on disk | ||
SetMaterialVectorParameter | Sets a Vector parameter in this Actor's material | ||
SetPhysicalMaterial | Overrides this Actor's Physical Material with a new one |
Returns | Name | Description | |
---|---|---|---|
AttachStartTo | Attached the beginning of this cable to another Actor at a specific bone or relative location | ||
AttachEndTo | Attached the end of this cable to another Actor at a specific bone or relative location | ||
DetachEnd | Detaches the End of this Cable | ||
DetachStart | Detaches the Start of this Cable | ||
SetCableSettings | Set the overall settings for this cable (visuals only) | ||
SetForces | Set the forces the cable has applied (visuals only) | ||
SetAngularLimits | Sets the Physics Angular Limits of this cable | ||
SetLinearLimits | Sets the Physics Linear Limits of this cable | ||
SetRenderingSettings | Set the rendering settings of this cable (visuals only) | ||
Base Actor | GetAttachedStartTo | Gets the Actor attached to Start | |
Base Actor | GetAttachedEndTo | Gets the Actor attached to End |
AttachStartTo
β
Attached the beginning of this cable to another Actor at a specific bone or relative location
my_cable:AttachStartTo(other, relative_location?, bone_name?)
Type | Parameter | Default | Description |
---|---|---|---|
Base Actor | other | ||
Vector | relative_location? | Vector(0, 0, 0) | |
string | bone_name? |
|
AttachEndTo
β
Attached the end of this cable to another Actor at a specific bone or relative location
my_cable:AttachEndTo(other, relative_location?, bone_name?)
Type | Parameter | Default | Description |
---|---|---|---|
Base Actor | other | ||
Vector | relative_location? | Vector(0, 0, 0) | |
string | bone_name? |
|
DetachEnd
β
Detaches the End of this Cable
my_cable:DetachEnd()
DetachStart
β
Detaches the Start of this Cable
my_cable:DetachStart()
SetCableSettings
β
Set the overall settings for this cable (visuals only)
my_cable:SetCableSettings(length, num_segments, solver_iterations)
Type | Parameter | Default | Description |
---|---|---|---|
float | length | Rest length of the cable. Default is 100 | |
integer | num_segments | How many segments the cable has. Default is 10 | |
integer | solver_iterations | The number of solver iterations controls how 'stiff' the cable is. Default is 0 |
SetForces
β
Set the forces the cable has applied (visuals only)
my_cable:SetForces(force, gravity_scale?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | force | Force vector (world space) applied to all particles in cable. Default is Vector(0, 0, 0) | |
float | gravity_scale? | 1 | Scaling applied to world gravity affecting this cable. Default is 1 |
SetAngularLimits
β
Sets the Physics Angular Limits of this cable
my_cable:SetAngularLimits(swing_1_motion, swing_2_motion, twist_motion, swing_1_limit?, swing_2_limit?, twist_limit?)
Type | Parameter | Default | Description |
---|---|---|---|
ConstraintMotion | swing_1_motion | Indicates whether the Swing1 limit is used | |
ConstraintMotion | swing_2_motion | Indicates whether the Swing2 limit is used | |
ConstraintMotion | twist_motion | Indicates whether the Twist limit is used | |
float | swing_1_limit? | 0 | Angle of movement along the XY plane. This defines the first symmetric angle of the cone |
float | swing_2_limit? | 0 | Angle of movement along the XZ plane. This defines the second symmetric angle of the cone |
float | twist_limit? | 0 | Symmetric angle of roll along the X-axis |
SetLinearLimits
β
Sets the Physics Linear Limits of this cable. If use_soft_constraint is enabled, then stiffness and damping will be used, otherwise restitution will be used.
my_cable:SetLinearLimits(x_motion, y_motion, z_motion, limit?, restitution?, use_soft_constraint?, stiffness?, damping?)
Type | Parameter | Default | Description |
---|---|---|---|
ConstraintMotion | x_motion | Indicates the linear constraint applied along the X-axis. Free implies no constraint at all. Locked implies no movement along X is allowed. Limited implies the distance in the joint along all active axes must be less than the Distance provided | |
ConstraintMotion | y_motion | Indicates the linear constraint applied along the Y-axis. Free implies no constraint at all. Locked implies no movement along Y is allowed. Limited implies the distance in the joint along all active axes must be less than the Distance provided | |
ConstraintMotion | z_motion | Indicates the linear constraint applied along theZX-axis. Free implies no constraint at all. Locked implies no movement along Z is allowed. Limited implies the distance in the joint along all active axes must be less than the Distance provided | |
float | limit? | 0 | The distance allowed between between the two joint reference frames. Distance applies on all axes enabled (one axis means line, two axes implies circle, three axes implies sphere) |
float | restitution? | 0 | Controls the amount of bounce when the constraint is violated. A restitution value of 1 will bounce back with the same velocity the limit was hit. A value of 0 will stop dead |
boolean | use_soft_constraint? | false | Whether we want to use a soft constraint (spring) |
float | stiffness? | 0 | Stiffness of the soft constraint. Only used when Soft Constraint is on |
float | damping? | 0 | Damping of the soft constraint. Only used when Soft Constraint is on |
SetRenderingSettings
β
Set the rendering settings of this cable (visuals only)
my_cable:SetRenderingSettings(width, num_sides, tile_material)
Type | Parameter | Default | Description |
---|---|---|---|
float | width | How wide the cable geometry is. Default is 6 | |
integer | num_sides | Number of sides of the cable geometry. Default is 4 | |
integer | tile_material | How many times to repeat the material along the length of the cable. Default is 1 |
GetAttachedStartTo
β
Gets the Actor attached to Start
β Returns Base Actor (the Actor or nil).
local ret = my_cable:GetAttachedStartTo()
GetAttachedEndTo
β
Gets the Actor attached to End
β Returns Base Actor (the Actor or nil).
local ret = my_cable:GetAttachedEndTo()
Eventsβ
Inherited Entity Events
Name | Description | |
---|---|---|
Spawn | Triggered when an Entity is spawned/created | |
Destroy | Triggered when an Entity is destroyed | |
ValueChange | Triggered when an Entity has a value changed with :SetValue() | |
ClassRegister | Triggered when a new Class is registered with the Inheriting System |
Inherited Actor Events
Name | Description | |
---|---|---|
Spawn | Triggered when an Entity is spawned/created | |
Destroy | Triggered when an Entity is destroyed | |
ValueChange | Triggered when an Entity has a value changed with :SetValue() | |
ClassRegister | Triggered when a new Class is registered with the Inheriting System |