Scripting Essentials - ChloeSpacedOut/figura-physbone-api GitHub Wiki

Script Setup

To fully customize your physBones, you will need to correctly set up your own script. First you will need to require the physBone API. Doing so should look like this:

local physBone = require('physBoneAPI')

If physBoneAPI is in a folder, make sure to specify that. E.g. require('myFolder.physBoneAPI')

Next you will need to make an entity_init() function. PhysBone functions can't run before entity init, so it'll be required to run them at the start of your script. With this done, your script should look like this:

local physBone = require('physBoneAPI')
function events.entity_init()
    -- physbone functions here
end

Editing your PhysBones

To edit your physBones, you need to first access your physBone, then apply a function. The basic method of this is just physBone.yourPhysBoneName:yourFunction(), where yourPhysBoneName is the name of your physBone group in Blockbench, and yourFunction is a function from the physBone docs. Editing your physBones must be done during of after entitiy_init().

For example:

local physBone = require('physBoneAPI')
function events.entity_init()
    physBone.myPhysBone:setGravity(-4)
end