Skip to main content
Version: bleeding-edge ๐Ÿฉธ

Base Pickable

Pickables are special Actors which can be grabbed, held and used by Characters.

๐Ÿ‘ชBase Class
This is a Base Class. Base Classes are abstract definitions used to share common methods and events between related child classes, thus you cannot spawn it directly.

Classes that share methods and events from this Base Class: Grenade, Melee, Weapon.
๐Ÿง‘โ€๐Ÿ’ปAPI Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

They have special methods and events and are highlighted when looked at by a Character.

๐Ÿฆ ย Functionsโ€‹

ReturnsNameDescription
AddSkeletalMeshAttachedAttaches a Skeletal Mesh as master pose to this entity
AddStaticMeshAttachedAttaches a Static Mesh to this entity
table of stringGetAllSkeletalMeshAttachedGets all Skeletal Meshes attached to this entity
table of stringGetAllStaticMeshAttachedGets all Static Meshes attached to this entity
Character or nilGetHandlerGets the Character, if it exists, that's holding this Pickable
HandlingModeGetHandlingModeGets the Handling Mode of this Pickable
SkeletalMesh ReferenceGetMeshGets the name of the asset this Pickable uses
PullUsePulls the usage of this Pickable (will start firing if this is a weapon)
ReleaseUseReleases the usage of this Pickable (will stop firing if this is a weapon)
RemoveAllSkeletalMeshesAttachedRemoves all SkeletalMeshes attached
RemoveAllStaticMeshesAttachedRemoves all StaticMeshes attached
RemoveSkeletalMeshAttachedRemoves, if it exists, a SkeletalMesh from this Pickable given its custom ID
RemoveStaticMeshAttachedRemoves, if it exists, a StaticMesh from this Pickable given its custom ID
SetAttachmentSettingsSets the Attachment Settings for this Pickable (how it attaches to the Character when Picking up)
SetCanUseSets if this Pickable can be used by the player when held
SetCrosshairMaterialSets the crosshair material for this Pickable
SetPickableSets if this Pickable can be picked up from ground by the player
SetStaticMeshAttachedTransformSets a Static Mesh Attached location and rotation

AddSkeletalMeshAttachedโ€‹

Spawns and attaches a SkeletalMesh to this entity, the SkeletalMesh must have the same skeleton used by this Actor's mesh, and will follow all animations from it. Uses a custom ID to be used for removing/customizing it afterwards
๐Ÿ†•Updated Function
This method was recently updated in ver. 1.144. See the Compatibility Versions page for more information.
my_pickable:AddSkeletalMeshAttached(id, skeletal_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, use_base_leader_pose_component?, animation_path?, attachable_id?)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Used further for removing or applying material settings on it
SkeletalMesh Referenceskeletal_mesh_path Required parameter Path to SkeletalMesh asset to attach
stringsocket?Bone socket to attach to
Vectorrelative_location?Vector(0, 0, 0)Relative location
Rotatorrelative_rotation?Rotator(0, 0, 0)Relative rotation
booleanuse_parent_bounds?trueIf true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together
booleanuse_base_leader_pose_component?trueIf true, this component will use the base leader pose component for copying its animation
Animation Referenceanimation_path?Path to Animation asset to play on the Skeletal Mesh attached
stringattachable_id?Optionally attaches this to another attached skeletal mesh (instead of attaching to the root component)

See also RemoveSkeletalMeshAttached.


AddStaticMeshAttachedโ€‹

Spawns and attaches a StaticMesh to this Pickable in a Socket with a relative location and rotation. Uses a custom ID to be used for removing/customizing it afterwards
my_pickable:AddStaticMeshAttached(id, static_mesh_path, socket?, relative_location?, relative_rotation?, use_parent_bounds?, attachable_id?)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID to assign to the StaticMesh
StaticMesh Referencestatic_mesh_path Required parameter Path to StaticMesh asset to attach
stringsocket?Bone socket to attach to
Vectorrelative_location?Vector(0, 0, 0)Relative location
Rotatorrelative_rotation?Rotator(0, 0, 0)Relative rotation
booleanuse_parent_bounds?trueIf true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together
stringattachable_id?Optionally attaches this to another attached static mesh (instead of attaching to the root component)

See also SetStaticMeshAttachedTransform, RemoveStaticMeshAttached.


GetAllSkeletalMeshAttachedโ€‹

Gets all Skeletal Meshes attached to this entity
local ret = my_pickable:GetAllSkeletalMeshAttached()

Returns

TypeDescription
table of stringthe key as the Attached ID, and the value as the Asset Path

GetAllStaticMeshAttachedโ€‹

Gets all Static Meshes attached to this entity
local ret = my_pickable:GetAllStaticMeshAttached()

Returns

TypeDescription
table of stringthe key as the Attached ID, and the value as the Asset Path

GetHandlerโ€‹

Gets the Character, if it exists, that's holding this Pickable
local ret = my_pickable:GetHandler()

Returns

TypeDescription
Character or nilNo description provided

GetHandlingModeโ€‹

Gets the Handling Mode of this Pickable
local ret = my_pickable:GetHandlingMode()

Returns

TypeDescription
HandlingModeNo description provided

GetMeshโ€‹

Gets the name of the asset this Pickable uses
local asset = my_pickable:GetMesh()

Returns

TypeDescription
SkeletalMesh Referenceasset

PullUseโ€‹

Pulls the usage of this Pickable (will start firing if this is a weapon)
my_pickable:PullUse(release_use_after?)

Parameters

TypeParameterDefaultDescription
floatrelease_use_after?-1Time in seconds to automatically release the usage (-1 will not release, 0 will release one tick after)

ReleaseUseโ€‹

Releases the usage of this Pickable (will stop firing if this is a weapon)
my_pickable:ReleaseUse()

RemoveAllSkeletalMeshesAttachedโ€‹

Removes all SkeletalMeshes attached
my_pickable:RemoveAllSkeletalMeshesAttached()

RemoveAllStaticMeshesAttachedโ€‹

Removes all StaticMeshes attached
my_pickable:RemoveAllStaticMeshesAttached()

RemoveSkeletalMeshAttachedโ€‹

Removes, if it exists, a SkeletalMesh from this Pickable given its custom ID
my_pickable:RemoveSkeletalMeshAttached(id)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID of the SkeletalMesh to remove

See also AddSkeletalMeshAttached.


RemoveStaticMeshAttachedโ€‹

Removes, if it exists, a StaticMesh from this Pickable given its custom ID
my_pickable:RemoveStaticMeshAttached(id)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID of the StaticMesh to remove

See also AddStaticMeshAttached.


SetAttachmentSettingsโ€‹

Sets the Attachment Settings for this Pickable (how it attaches to the Character when Picking up)
my_pickable:SetAttachmentSettings(relative_location, relative_rotation?, socket?)

Parameters

TypeParameterDefaultDescription
Vectorrelative_location Required parameter Location relative to the Socket
Rotatorrelative_rotation?Rotator(0, 0, 0)Rotation relative to the Socket
stringsocket?hand_r_socketCharacter Socket to attach to when picked up

SetCanUseโ€‹

Sets if this Pickable can be used by the player when held
my_pickable:SetCanUse(can_use)

Parameters

TypeParameterDefaultDescription
booleancan_use Required parameter No description provided

SetCrosshairMaterialโ€‹

Sets the crosshair material for this Pickable
my_pickable:SetCrosshairMaterial(material_asset)

Parameters

TypeParameterDefaultDescription
Material Referencematerial_asset Required parameter Asset path to the crosshair material

SetPickableโ€‹

Sets if this Pickable can be picked up from ground by the player
my_pickable:SetPickable(is_pickable)

Parameters

TypeParameterDefaultDescription
booleanis_pickable Required parameter No description provided

SetStaticMeshAttachedTransformโ€‹

Sets a Static Mesh Attached location and rotation
my_pickable:SetStaticMeshAttachedTransform(id, relative_location, relative_rotation)

Parameters

TypeParameterDefaultDescription
stringid Required parameter Unique ID of the StaticMesh set with AddStaticMeshAttached
Vectorrelative_location Required parameter New relative location
Rotatorrelative_rotation Required parameter New relative rotation

See also AddStaticMeshAttached.

๐Ÿš€ย Eventsโ€‹

NameDescription
DropWhen a Character drops this Pickable
HitWhen this Pickable hits something
InteractTriggered when a Character interacts with this Pickable (i.e. tries to pick it up)
PickUpTriggered When a Character picks this up
PullUseTriggered when a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)
ReleaseUseTriggered when a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)

Dropโ€‹

When a Character drops this Pickable
Pickable.Subscribe("Drop", function(self, character, was_triggered_by_player)
-- Drop was called
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Pickable which has been dropped
CharactercharacterThe Character that dropped it
booleanwas_triggered_by_playerIf the Player actively pressed the Drop binding to drop

Hitโ€‹

When this Pickable hits something
Pickable.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity, other_actor)
-- Hit was called
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Actor that was hit
floatimpact_forceThe intensity of the hit normalized by the Pickable's weight
Vectornormal_impulseThe impulse direction of the hit
Vectorimpact_locationThe world space location of the impact
VectorvelocityThe Pickable's velocity at the moment it hit
Base Actor or nilother_actorThe other actor that hit this Pickable

Interactโ€‹

Triggered when a Character interacts with this Pickable (i.e. tries to pick it up)

Return false to prevent the interaction
Pickable.Subscribe("Interact", function(self, character)
-- Interact was called
return true
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Pickable that just got interacted with
CharactercharacterThe Character that interacted with it

PickUpโ€‹

Triggered When a Character picks this up
Pickable.Subscribe("PickUp", function(self, character)
-- PickUp was called
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Pickable that just got picked up
CharactercharacterThe Character that picked it up

PullUseโ€‹

Triggered when a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)
Pickable.Subscribe("PullUse", function(self, character)
-- PullUse was called
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Pickable which has just been used
CharactercharacterThe Character that used it

ReleaseUseโ€‹

Triggered when a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)
Pickable.Subscribe("ReleaseUse", function(self, character)
-- ReleaseUse was called
end)

Arguments

TypeArgumentDescription
Base PickableselfThe Pickable which has just stopped being used
CharactercharacterThe Character that stopped using it

โž• Available Crosshairsโ€‹

nanos world provides a bunch of crosshair materials which can be used in Weapons/Pickables. You can of course create your own crosshair material and use those instead!

All available Crosshairs

List of crosshair materials included in the default asset packโ€‹

  • nanos-world::MI_Crosshair_Circle
  • nanos-world::MI_Crosshair_Crossbow
  • nanos-world::MI_Crosshair_Dot
  • nanos-world::MI_Crosshair_Holo
  • nanos-world::MI_Crosshair_Launcher
  • nanos-world::MI_Crosshair_Regular
  • nanos-world::MI_Crosshair_Regular_X
  • nanos-world::MI_Crosshair_Rocket
  • nanos-world::MI_Crosshair_Separated_Triangle
  • nanos-world::MI_Crosshair_Shotgun
  • nanos-world::MI_Crosshair_Square
  • nanos-world::MI_Crosshair_Submachine
  • nanos-world::MI_Crosshair_Tee
  • nanos-world::MI_Crosshair_ThreeDots
  • nanos-world::MI_Crosshair_Triangle
  • nanos-world::MI_Crosshair_Vee