Blocks - polytrackmods/PolyModLoader GitHub Wiki
Blocks
You can add Blocks to PolyTrack using PolyModLoader
Making a Category
You can create a new block category using pml.editorExtras.registerCategory
pml.editorExtras.registerCategory(id, defaultId);
id
is the category id
defaultId
is the id of the block to be used as the category icon in the editor sidebar
Registering a model
In order for your blocks to have a custom model, you first have to register the model file which contains the models. Note that image textures are not supported by PolyTrack, only solid colors
You can register a model using pml.editorExtras.registerModel
pml.editorExtras.registerModel(url);
url
is the url to the model file, preferrably in .glb format. Please use a link to the model directly, not relative links, as those are not supported by some devices.
Registering a block
Blocks can be registered with pml.editorExtras.registerBlock
pml.editorExtras.registerBlock(id, categoryId, checksum, sceneName, modelName, offsetSpace, [extraSettings]);
id
is the block id
categoryId
is the id of the category the block should be registered in
checksum
is the checksum of the block
sceneName
is the name of the scene the object is in in the model, the scene name can be set inside blender as seen in the screenshot below
modelName
is the name of the object in the scene which should be used as the block's model
offsetSpace
contains the space the block takes up in the editor (purely for overlap detection purposes) and the offset of the block in this format:
[spaceX, spaceY, spaceZ],[offsetX, offsetY,offsetZ](/polytrackmods/PolyModLoader/wiki/spaceX,-spaceY,-spaceZ],[offsetX,-offsetY,offsetZ)
extraSettings
is optional. Putting { ignoreOnExport: true }
here will cause the block to be ignored on export. This can be used for several purposes, like the copy and paste pillars in the advanced PolyEditor mod.