User Tools

Site Tools


attach_points

This is an old revision of the document!


Attach Points


Attach points allow you to dynamically attach object models to characters, tiles, or even other objects during the game (for example, to place a sword into a character's hand, a torch onto a dungeon wall, or a book onto a table).

Creating Attach Points

“Create Attach Point” mode (F8 shortcut key), left-click voxel to place at that coordinate

Attach point ID is unique per model frame

White cube with link icon will display at attach point positions

To change the ID for an attach point, selected the desired ID from the “Attach Points” dropdown on the Model Properties Panel, then click the “pencil” button to the right of the dropdown. A popup dialog will be displayed prompting for the new ID.

To remove a previously created attach point, select the desired ID from the “Attach Points” dropdown on the Model Properties panel, then click the red “X” button to the right of the dropdown. A popup dialog will be displayed to confirm its removal.

Offset, Rotation, and Scale

There are several properties that can be adjusted for attach points from the Model Properties panel: offset, rotation, and scale. These properties affect an object's appearance when attached to that particular attach point. The settings for these properties can be assigned per frame, allowing attached objects to be animated along with the parent model.

PropertyDescription
OffsetThe offset values define the position of the attach point within the frame and is relative to the model grid's center (at ground level). When an object model (the “child”) is attached to an entity (the “parent”), the attach points for the parent and child models will be connected together at their respective attach point locations.
RotationThe rotation values determine the angle of an attached object. This can be used, for example, to angle a sword downward along with the swinging of a character's arm during an attack animation.
Scale FactorThe scale factor value determines the size of an object when attached to an attach point. A scale factor of 1 will keep the model's original size, whereas a value of 2 will double the model's size. The default scale factor of 1.05 will enlarge models slightly to help prevent z-fighting.

Scripting with Attach Points

attach_object("sword", player, "handle", "right_hand")
attach_object("sword", player, "hand")
detach_object(player, "right_hand")

Equipment

Automatic attaching based on attach point ID when an item is equipped and an object model is assigned to that item)

Steps to follow:

- Toggle “Equippable” to “On” for the item in the Item Editor

- Assign an “Object Model” to the item in the Item Editor

- Create an attach point for both the character and object that match the equipment slot ID (e.g. “right_hand”)

- Call “equip_item” scripting function to equip the item to the appropriate slot (e.g. “right_hand”) and object will automatically be attached to the corresponding attach point

attach_points.1601178532.txt.gz · Last modified: 2020/09/26 20:48 by justin