Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / BoneAttachmentComponent

Class: BoneAttachmentComponent ​

Defined in: components/BoneAttachment.ts:80

Fixes an entity to a bone of its PARENT's model — a sword in a hand, a hat on a head, a backpack on the chest — so it moves with every animation.

The entity's ParentId stays the character; this names the bone. The ObjectManagementSystem then parents the entity's object under that bone (through a small socket that cancels the rig's scale), and the entity's Transform becomes its offset FROM the bone: position in metres, rotation relative to the bone. Until the model has loaded, or when the bone isn't found, the entity sits under the character as an ordinary child.

holds change that per clip of the character's Animation component, so a rifle can be in the hands in the rifle clips, on the back in Idle and hidden in the rest. With no clip playing the attachment is as its own fields say.

Attach and detach with ObjectManagementSystem.attachToBone / detachFromBone, which can keep the entity where it is in the world.

Extends ​

Constructors ​

Constructor ​

ts
new BoneAttachmentComponent(options?): BoneAttachmentComponent;

Defined in: components/BoneAttachment.ts:94

Parameters ​

ParameterType
options?BoneAttachmentOptions

Returns ​

BoneAttachmentComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
bonestringThe bone's node name in the parent's model.components/BoneAttachment.ts:82
humanoidstring | nullThe bone's humanoid name, the fallback when the node name isn't found.components/BoneAttachment.ts:84
compensateScalebooleanCancel the bone's world scale (offsets in metres on a centimetre rig).components/BoneAttachment.ts:86
enabledbooleanWhether the entity follows the bone. Off: an ordinary child of the character.components/BoneAttachment.ts:88
holdsBoneHold[]Where the entity goes in particular clips; the first hold naming the clip wins.components/BoneAttachment.ts:90
hideInOtherClipsbooleanHide the entity while a clip no hold names is playing.components/BoneAttachment.ts:92