Skip to main content
Version: bleeding-edge 🩸

πŸ“¦ Prop

A Prop represents a Dynamic Mesh which can be spawned in the world, can be grabbed around by characters and have physics.

info

🟦🟧 Authority: This class can be spawned on both Client and Server (if you spawn it on client, it won't be synchronized with other players).

⏬ Inheritance: This class inherits from Actor and Paintable.

note

If the Prop was spawned by the Client. It will have all interactions disabled (grabbable).

Usage​

local my_prop = Prop(
Vector(-900, 185, 215),
Rotator(0, 90, 90),
"nanos-world::SM_Crate_07"
)
Note

Props smaller than radius 40 units or very thin (any side smaller than 20 units) will have CCD (Continuous Collision Detection) enabled to avoid falling through the floor or other objects. This will slightly increase the performance cost of them!

Note

Props bigger than radius 200 units will have Grabbable off by default. This can be overridden with :SetGrabbable().

Note

Setting CollisionType.Auto on Props will make them automatically switch between Normal and IgnoreOnlyPawn if they are smaller than radius 40 units.

Constructor Parameters​

TypeNameDefault ValueDescription
VectorlocationVector(0, 0, 0)Location to spawn
RotatorrotationRotator(0, 0, 0)Rotation to spawn
StaticMesh Assetasset Static Mesh Asset to use
CollisionTypecollision_typeCollisionType.AutoCollision
booleangravity_enabledtrue
booleanis_grabbabletrue
booleanforce_no_ccdfalseForce CCD to not be used on small Props (may cause Props passing through objects if it's kinda small)

Functions​

Inherited Actor Functions
ReturnsNameDescription
AddImpulseApplies a Force in world space to this Actor
AttachToAttaches this Actor to another Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets this Actor's collision type
SetForceAdds a permanent force to this Actor
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets the Actor visibility
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed
SetLocationSets this Actor's location in the game world
SetNetworkAuthoritySets the Player this Actor will have its physics calculated on Network Authority
SetRelativeLocationSets this Actor's relative location in local space
SetRelativeRotationSets this Actor's relative rotation in local space
SetRotationSets this Actor's rotation in the game world
SetScaleSets this Actor's scale
SetValueSets a value in this Actor, which can be accessed by any package
TranslateToSmoothly moves this Actor to the specified location
RotateToSmoothly rotates this Actor to the specified angle
booleanHasNetworkAuthorityGets if the LocalPlayer is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
booleanIsBeingDestroyedGets if this Actor is being destroyed
booleanIsGravityEnabledGets whether gravity is enabled on this Actor
booleanIsVisibleGets whether this actor is Visible or not
booleanIsInWaterGets if this Actor is in water
booleanIsNetworkDistributedGets if this Actor is currently Network Distributed
booleanIsValidReturns if this Actor is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all Actors attached to this Actor
anyGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
numberGetCollisionGets this Actor's collision type
numberGetIDGets the universal network ID of this Actor
VectorGetLocationGets this Actor's location in the game world
RotatorGetRotationGets this Actor's angle in the game world
VectorGetForceGets this Actor's scale
VectorGetScaleGets this Actor's scale
stringGetTypeGets the type of this Actor
anyGetValueGets a value stored on this Actor at the given key
VectorGetVelocityReturns this Actor's current velocity
stringAddActorTagAdds an Unreal Actor Tag to this Actor
stringRemoveActorTag`Remove an Unreal Actor Tag from this Actor
tableGetActorTagsGets all Unreal Actor Tags from this Actor
functionSubscribeSubscribes to an Event
UnsubscribeUnsubscribes from an Event
Inherited Paintable Functions
ReturnsNameDescription
SetMaterialSets the material at the specified index of this Actor
SetMaterialFromWebUISets the material at the specified index of this Actor to a WebUI object
SetMaterialFromSceneCaptureSets the material at the specified index of this Actor to a SceneCapture object
ResetMaterialResets the material from the specified index to the original one
SetMaterialColorParameterSets a Color parameter in this Actor’s material
SetMaterialScalarParameterSets a scalar parameter in this Actor’s material
SetMaterialTextureParameterSets a texture parameter in this Actor's material to an image on disk
SetMaterialVectorParameterSets a Vector parameter in this Actor’s material
SetPhysicalMaterialOverrides this Actor's Physical Material with a new one
ReturnsNameDescription
SetGrabbableSets ability to Characters to Grab this Prop
SetPhysicsDampingSets the Physics damping of this Prop
stringGetAssetNameGets the Asset name
CharacterGetHandlerGets the Character (if existing) which is holding this
booleanIsGrabbableGets ability to Grab this Prop

SetGrabbable​

Sets ability to Characters to Grab this Prop

my_prop:SetGrabbable(is_grabbable)
TypeParameterDescription
booleanis_grabbableIf the Prop will be able to be grabbable or not

SetPhysicsDamping​

Sets the Physics damping of this Prop

my_prop:SetPhysicsDamping(linear_damping, angular_damping)
TypeParameterDescription
numberlinear_damping
numberangular_damping

GetAssetName​

Gets the Asset name

Returns string

local asset_name = my_prop:GetAssetName()
-- e.g. returns "nanos-world::SM_Cube"

GetHandler​

Gets the Character (if existing) which is holding this

Returns Character

local handler = my_prop:GetHandler()

IsGrabbable​

Gets ability to Grab this Prop

Returns boolean

my_prop:IsGrabbable()

Events​

Inherited Actor Events
NameDescription
DestroyTriggered when an Actor is destroyed
SpawnTriggered when an Actor is spawned/created
ValueChangeTriggered when an Actor has a value changed with :SetValue()
NameDescription
GrabTriggered when Character grabs a Prop
HitTriggered when this Prop hits something
InteractTriggered when a Character tries to Grab up this
TakeDamageTriggered when a Prop takes Damage
UnGrabTriggered when Character ungrabs a Prop

Grab​

Triggered when Character grabs a Prop

Prop.Subscribe("Grab", function(self, character)

end)
TypeParameterDescription
PropselfThe prop which was Grabbed
CharactercharacterThe new Grabber

Hit​

Triggered when this Prop hits something

Prop.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity)

end)
TypeParameterDescription
PropselfThe prop which has been hit
numberimpact_forceThe intensity of the Hit normalized by the Prop's weight
Vectornormal_impulseThe impulse direction it hits
Vectorimpact_locationThe world 3D location of the impact
VectorvelocityThe Prop velocity at the moment it hits

Interact​

When a Character interacts with this Prop (i.e. try to Grab it)

Return false to prevent it

TypeParameterDescription
Propself
Charactercharacter

TakeDamage​

When Prop takes Damage

TypeParameterDescription
Propself
numberdamage
stringboneDamaged bone
DamageTypetypeDamage Type
Vectorfrom_directionDirection of the damage relative to the damaged actor
PlayerinstigatorThe player which caused the damage
anycauserThe object which caused the damage
Prop.Subscribe("TakeDamage", function(self, damage, bone, type, from_direction, instigator, causer)

end)

UnGrab​

Triggered when this Prop hits something

Prop.Subscribe("UnGrab", function(self, character)

end)
TypeParameterDescription
PropselfThe prop which has been ungrabbed
CharactercharacterThe old Grabber