Log inGet started
Package

avatarMapping.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

avatarMapping

How a skeleton maps onto an avatar type, read and corrected.

local avatarMapping = require("@builtin::modules.avatarMapping")
local subject = avatarMapping.subject("my_hero", nil, "me")      -- an avatar, bundle, rig or avatar entity
local before = avatarMapping.report(subject)                     -- every role, its bone, detected or set by hand
local roles = avatarMapping.overrides(subject.rig, subject.type)
roles.leftforearm = "mixamorig:LeftForeArm"
avatarMapping.setOverrides(subject.rig, subject.type, roles, "me")
print(#avatarMapping.diff(before, avatarMapping.report(subject)).roles)
print(avatarMapping.scores(subject.rig).worst.slide)            -- bakes idle, walk and run onto the rig
  • subject(v, type?, who) reads what a mapping is about: an avatar (its body's rig, under the avatar's own type), a body bundle, a rig, or a live avatar entity.
  • report(subject) states every role with its bone, source (detected, override or cleared), the confidence of its chain, and the type's report: missing chains, ambiguities, names that disagree with the structure, overrides naming bones the rig lacks.
  • overrides(rig, type) and setOverrides(rig, type, roles, who) read and write the author's { [role] = bone | false } a rig keeps for one type, in its rig.json, which a re-import keeps. A rig a library ships keeps no overrides from a world.
  • diff(before, after) states the roles whose bone moved.
  • scores(rig, clips?) bakes clips onto the rig and measures the foot slide and joint angles.

The avatar toolbox (avatar.inspect, avatar.map, avatar.unmap, avatar.detect, avatar.promote) and the avatar, bundle and rig inspectors read and write through it.