Skip to main content
Version: latest - a1.0.0 ⚖️

⛓️ Cable

A Cable represents a Physics Constraint which joins two Actors with a rope-like visual representation between them

nanos world 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().

After attaching the two sides of your cable, the physics can be tweaked to affect how the constraint will affect the objects.

tip

Cables are automatically destroyed when one of the sides are detached

tip

You can find more useful information regarding physical properties of the joint in the end of this page.

Usage#

Server/Index.lua
local my_cable: = Cable()local cube_01 = Prop(Vector(100, 100, 100), Rotator(), "nanos-world::SM_Cube")local cube_02 = Prop(Vector(200, 0, 100), Rotator(), "nanos-world::SM_Cube")
my_cable::AttachStartTo(cube_01)my_cable::AttachEndTo(cube_02)

Constructor Parameters#

TypeNameDefault
VectorlocationVector(0, 0, 0)

Functions#

Inherited Actor Functions
Base Actorscripting-reference/classes/base-classes/actor
ReturnsNameDescription
AddImpulseApplies a Force in world coordinate on this Actor
AttachToAttaches this Actor to any other Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets the actor’s collision type
SetForceAdds a permanent force to this actor
SetGravityEnabledSets the actor’s gravity enabled
SetHighlightEnabledEnables this Actor Highlighting at a specific Index color
SetLifeSpanSets the actor’s life span to be destroyed
SetLocationSets the actor’s location in the game world
SetNetworkAuthoritySets this actor’s new Player Network Authority
SetRelativeLocationSets the actor’s relative location in local space
SetRelativeRotationSets the actor’s relative rotation in local space
SetRotationSets the actor’s rotation in the game world
SetScaleSets the actor’s scale
SetValueSets a value in this entity, which can be accessed by any package
TranslateToSmoothly moves this actor to a Location
RotateToSmoothly rotates this actor to a Rotation
booleanIsGravityEnabledGets the actor’s gravity enabled
booleanIsInWaterGets if the actor is in Water
booleanIsNetworkDistributedGets if the actor is Network Distributed
booleanIsValidReturns if this entity is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all actors attached to this entity
anyGetAttachedToGets the actor this actor is attached to
tableGetBoundsGets the actor bounds size
numberGetCollisionGets the current actor’s collision
numberGetIDGets the universal network ID of this entity
VectorGetLocationGet the actor’s position in the game world
VectorGetInitialLocationGets the initial location
RotatorGetRotationGets the actor’s rotation in the game world
VectorGetScaleGets the actor’s scale
stringGetTypeReturns the type of this Actor
anyGetValueGets a value given a key
VectorGetVelocityReturns the current actor Velocity
SubscribeSubscribes for an Event
UnsubscribeUnsubscribes from Events
Inherited Paintable Functions
Base Paintablescripting-reference/classes/base-classes/paintable
ReturnsNameDescription
SetMaterialReplace a materials of this actor with another Material
SetMaterialFromWebUIReplace a materials of this actor with a WebUI
SetMaterialColorParameterSets a Color parameter in this actor’s material
SetMaterialScalarParameterSets a scalar parameter in this actor’s material
SetMaterialTextureParameterLoads a image from computer (relative to Assets/ folder) and sets as parameter in this actor’s material
SetMaterialVectorParameterSets a Vector parameter in this actor’s material
ReturnsNameDescription
AttachStartToAttached the beginning of this cable to another Actor at a specific bone or relative location
AttachEndToAttached the end of this cable to another Actor at a specific bone or relative location
DetachEndDetaches the End of this Cable
DetachStartDetaches the Start of this Cable
SetAngularLimitsSets the Physics Angular Limits of this cable
SetCableSettingsSet the overall settings for this cable (visuals only)
SetForcesSet the forces the cable has applied (visuals only)
SetLinearLimitsSets 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.
SetRenderingSettingsSet the rendering settings of this cable (visuals only)

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)
TypeParameterDefault ValueDescription
Actorother
Vectorrelative_locationVector()
stringbone_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)
TypeParameterDefault ValueDescription
Actorother
Vectorrelative_locationVector()
stringbone_name``

DetachEnd#

Detaches the End of this Cable

my_cable:DetachEnd()

DetachStart#

Detaches the Start of this Cable

my_cable:DetachStart()

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)
TypeParameterDefault ValueDescription
ConstraintMotionswing_1_motion
ConstraintMotionswing_2_motion
numberswing_1_limit
numberswing_2_limit
numbertwist_limit

SetCableSettings#

Set the overall settings for this cable (visuals only)

my_cable:SetCableSettings(length, num_segments, solver_iterations)
TypeParameterDefault ValueDescription
numberlength
numbernum_segments
numbersolver_iterations

SetForces#

Set the forces the cable has applied (visuals only)

my_cable:SetForces(force, gravity_scale)
TypeParameterDefault ValueDescription
Vectorforce
numbergravity_scale1

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)
TypeParameterDefault ValueDescription
numberx_motion
numbery_motion
numberz_motion
numberlimit
numberrestitution0
booleanuse_soft_constraintfalse
numberstiffness0
numberdamping0

SetRenderingSettings#

Set the rendering settings of this cable (visuals only)

my_cable:SetRenderingSettings(width, num_sides, tile_material)
TypeParameterDefault ValueDescription
numberwidth
numbernum_sides
numbertile_material

Events#

Inherited Actor Events
Base Actorscripting-reference/classes/base-classes/actor
NameDescription
DestroyTriggered when an Entity is Destroyed
SpawnTriggered when an Entity is Spawned/Created
ValueChangeTriggered when an Entity has it’s value changed